﻿var myTree = [{
        "id": 1,
        "code": 10000,
        "pid": 0,
        "name": "场所环境安全",

    },
    {
        "id": 6,
        "code": 10001,
        "pid": 1,
        "name": "散粮站场所",
    },
    {
        "id": 7,
        "code": 10002,
        "pid": 1,
        "name": "公司场所环境",
    },

    {
        "id": 2,
        "pid": 0,
        "code": 20000,
        "name": "检维修安全",

    },
    {
        "id": 3,
        "pid": 0,
        "code": 30000,
        "name": "设备设施安全",

    },
    {
        "id": 4,
        "pid": 0,
        "code": 40000,
        "name": "生产作业活动",
    },
    {
        "id": 5,
        "code": 50000,
        "pid": 0,
        "name": "应急知识",
    },
    {
        "id": 8,
        "code": 20001,
        "pid": 2,
        "name": "叉车、挖掘机",
    },
    {
        "id": 9,
        "code": 20002,
        "pid": 2,
        "name": "电、气焊作业安全",
    },
    {
        "id": 10,
        "code": 20003,
        "pid": 2,
        "name": "港务设施维修",
    },
    {
        "id": 11,
        "code": 30001,
        "pid": 3,
        "name": "机设备机械",
    },

    {
        "id": 12,
        "code": 40001,
        "pid": 4,
        "name": "特殊作业安全风险",
    },
    {
        "id": 13,
        "code": 50001,
        "pid": 5,
        "name": "公司舱内",
    },
    {
        "id": 14,
        "code": 50002,
        "pid": 5,
        "name": "公司堆场",
    }, {
        "id": 15,
        "code": 50003,
        "pid": 5,
        "name": "公司固机队",
    },

];

function randomTreeNode(tree, pid, b) {
    var result = '';
    var tempArray = [];
    if (!b) {
        var idArray = [];
        var pidArray = [];
        tree.forEach(function (v, i) {
            if (pid) {
                if (pid == v.pid) {
                    idArray.push(v.id);
                    pidArray.push(v.pid);
                }
            } else {
                idArray.push(v.id);
                pidArray.push(v.pid);
            }
        })
        tempArray = idArray.filter(function (v) {
            return pidArray.indexOf(v) === -1
        });
        result = tempArray[Math.floor(Math.random() * tempArray.length)] + '';
    } else {
        tree.forEach(function (v, i) {
            if (v.pid + '' == '0') {
                tempArray.push(v.id);
            }
        })
        result = tempArray[Math.floor(Math.random() * tempArray.length)] + '';
    }
    return result;
}
// 承包商名录管理
var $ContractorDirectoryManagement = {
    DealUrl: function (vueApp, url, type, param) {
        var my = vueApp;
        switch (url) {
            //获取List数据
            case '/api/ContractorDirectoryManagement/GetList':
                Mock.mock(host + url, type,
                    function (options) {
                        if ($ContractorDirectoryManagement.EquipmenFacilities.length == 0) {
                            $ContractorDirectoryManagement.InitArray();
                        }
                        var p = JSON.parse(options.body);
                        //条件

                        var ContractorName = p.model.ContractorName;
                        var ConstructionCategory = getDicValue("25", p.model.ConstructionCategory);
                        //分页
                        var offset = p.offset;
                        var limit = p.limit;
                        var limitUsers2 = [];
                        for (var i = 0; i < $ContractorDirectoryManagement.EquipmenFacilities.length; i++) {
                            var user = $ContractorDirectoryManagement.EquipmenFacilities[i];
                            if (ContractorName && user.ContractorName.indexOf(ContractorName) == -1)
                                continue;
                            if (ConstructionCategory && user.ConstructionCategory.indexOf(ConstructionCategory) == -1)
                                continue;
                            user.ConstructionCategory = getDicValue("25", user.ConstructionCategory) == '' ? user.ConstructionCategory : getDicValue("25", user.ConstructionCategory);
                            limitUsers2.push(user);
                        }
                        var limitUsers = [];
                        for (var i = 0; i < limitUsers2.length; i++) {
                            if (i < offset + limit && i >= offset) {
                                limitUsers.push(limitUsers2[i]);
                            }
                        }
                        return {
                            result: "Success",
                            message: null,
                            data: {
                                pageData: limitUsers,
                                rowCount: limitUsers2.length
                            }
                        };
                    });
                break;
            case '/api/ContractorDirectoryManagement/get':
                Mock.mock(host + url + '?' + param, type, function (options) {

                    var myUsers = parent.$ContractorDirectoryManagement.EquipmenFacilities;
                    myuser = {};
                    for (var i = 0; i < myUsers.length; i++) {
                        if (myUsers[i].id == vueApp.id) {
                            myuser = myUsers[i];
                            break;
                        }
                    }
                    myuser.ConstructionCategory = getDicKey("25", myuser.ConstructionCategory);
                    return {
                        result: "Success",
                        message: null,
                        data: myuser
                    };
                });
                break;
                ////提交
            case '/api/ContractorDirectoryManagement/Save':
                Mock.mock(host + url, type, function (options) {
                    var thisuser = JSON.parse(options.body);
                    var thisUsers = parent.$ContractorDirectoryManagement.EquipmenFacilities;
                    var cz = true;
                    for (var i = 0; i < thisUsers.length; i++) {
                        if (thisUsers[i].id == thisuser.id) {
                            thisUsers[i].ContractorName = thisuser.ContractorName;
                            thisUsers[i].PrincipalName = thisuser.PrincipalName;
                            thisUsers[i].contact = thisuser.contact;
                            thisUsers[i].Qualification = thisuser.Qualification;
                            thisUsers[i].QualificationLevel = thisuser.QualificationLevel;
                            thisUsers[i].Administration = thisuser.Administration;
                            thisUsers[i].ConstructionCategory = thisuser.ConstructionCategory;
                            thisUsers[i].TechnicalStaffSituation = thisuser.TechnicalStaffSituation;
                            thisUsers[i].MainaAchievement = thisuser.MainaAchievement;


                            thisUsers[i].EmploymentLicenseList = thisuser.EmploymentLicenseList;
                            cz = false;
                            break;
                        }
                    }
                    if (cz) {
                        //Input 页面需要 去操作List页面的数组 parent
                        parent.$ContractorPersonnelDirectory.EquipmenFacilities.push({
                            id: thisuser.id,
                            ContractorName: thisuser.ContractorName,
                            PrincipalName: thisuser.PrincipalName,
                            contact: thisuser.contact,
                            Qualification: thisuser.Qualification,
                            QualificationLevel: thisuser.QualificationLevel,
                            Administration: thisuser.Administration,
                            ConstructionCategory: thisuser.ConstructionCategory,
                            TechnicalStaffSituation: thisuser.TechnicalStaffSituation,
                            MainaAchievement: thisuser.MainaAchievement,


                            EmploymentLicenseList: thisuser.EmploymentLicenseList
                        });
                    }
                    return {
                        result: "Success",
                        message: null,
                        data: null
                    };
                });
                break;
        }
    },
    EquipmenFacilities: [],
    InitArray: function () {
        for (var i = 0; i < 80; i++) {
            $ContractorDirectoryManagement.EquipmenFacilities.push(Mock.mock({
                id: Mock.Random.id(),
                ContractorName: randomValue("139"), //承包商名称
                PrincipalName: Mock.Random.cname(), //负责人姓名
                contact: randomValue("n64"), //联系方式
                Age: Mock.mock('@integer(25, 50)'),
                // Qualification: Mock.mock('@cparagraph(1, 1)'),
                Qualification: '',
                IDNumber: Mock.mock('@float(0)'),
                ConstructionCategory: randomValue("25"),
                SupervisorManufacturer: randomValue("chy1"),
                Administration: randomValue("08"),
                QualificationLevel: Mock.mock('@integer(1, 5)'),
                // TechnicalStaffSituation: Mock.mock('@cparagraph(1, 1)'),
                TechnicalStaffSituation: '',
                // MainaAchievement: Mock.mock('@cparagraph(1, 1)'),
                MainaAchievement: '',
                EmploymentLicenseList: [{
                    LicenseName: Mock.Random.cname(),
                    BeginTime: Mock.mock('@datetime()'),
                    EndTime: Mock.mock('@datetime()'),
                    EditorTime: Mock.mock('@datetime()'),
                    EditorPeople: Mock.Random.cname(),
                }],
            }));

        }
    }
}
// 承包商名录管理 黑名单
var $BlackContractorDirectoryManagement = {
    DealUrl: function (vueApp, url, type, param) {
        var my = vueApp;
        switch (url) {
            //获取List数据
            case '/api/BlackContractorDirectoryManagement/GetList':
                Mock.mock(host + url, type,
                    function (options) {
                        if ($BlackContractorDirectoryManagement.EquipmenFacilities.length == 0) {
                            $BlackContractorDirectoryManagement.InitArray();
                        }
                        var p = JSON.parse(options.body);
                        //条件

                        var ContractorName = p.model.ContractorName;
                        var ConstructionCategory = getDicValue("25", p.model.ConstructionCategory);
                        //分页
                        var offset = p.offset;
                        var limit = p.limit;
                        var limitUsers2 = [];
                        for (var i = 0; i < $BlackContractorDirectoryManagement.EquipmenFacilities.length; i++) {
                            var user = $BlackContractorDirectoryManagement.EquipmenFacilities[i];
                            if (ContractorName && user.ContractorName.indexOf(ContractorName) == -1)
                                continue;
                            if (ConstructionCategory && user.ConstructionCategory.indexOf(ConstructionCategory) == -1)
                                continue;
                            user.ConstructionCategory = getDicValue("25", user.ConstructionCategory) == '' ? user.ConstructionCategory : getDicValue("25", user.ConstructionCategory);
                            limitUsers2.push(user);
                        }
                        var limitUsers = [];
                        for (var i = 0; i < limitUsers2.length; i++) {
                            if (i < offset + limit && i >= offset) {
                                limitUsers.push(limitUsers2[i]);
                            }
                        }
                        return {
                            result: "Success",
                            message: null,
                            data: {
                                pageData: limitUsers,
                                rowCount: limitUsers2.length
                            }
                        };
                    });
                break;
            case '/api/BlackContractorDirectoryManagement/get':
                Mock.mock(host + url + '?' + param, type, function (options) {

                    var myUsers = parent.$BlackContractorDirectoryManagement.EquipmenFacilities;
                    myuser = {};
                    for (var i = 0; i < myUsers.length; i++) {
                        if (myUsers[i].id == vueApp.id) {
                            myuser = myUsers[i];
                            break;
                        }
                    }
                    myuser.ConstructionCategory = getDicKey("25", myuser.ConstructionCategory);
                    return {
                        result: "Success",
                        message: null,
                        data: myuser
                    };
                });
                break;
                ////提交
            case '/api/BlackContractorDirectoryManagement/Save':
                Mock.mock(host + url, type, function (options) {
                    var thisuser = JSON.parse(options.body);
                    var thisUsers = parent.$BlackContractorDirectoryManagement.EquipmenFacilities;
                    var cz = true;
                    for (var i = 0; i < thisUsers.length; i++) {
                        if (thisUsers[i].id == thisuser.id) {
                            thisUsers[i].ContractorName = thisuser.ContractorName;
                            thisUsers[i].PrincipalName = thisuser.PrincipalName;
                            thisUsers[i].contact = thisuser.contact;
                            thisUsers[i].Qualification = thisuser.Qualification;
                            thisUsers[i].QualificationLevel = thisuser.QualificationLevel;
                            thisUsers[i].Administration = thisuser.Administration;
                            thisUsers[i].ConstructionCategory = thisuser.ConstructionCategory;
                            thisUsers[i].TechnicalStaffSituation = thisuser.TechnicalStaffSituation;
                            thisUsers[i].MainaAchievement = thisuser.MainaAchievement;


                            thisUsers[i].EmploymentLicenseList = thisuser.EmploymentLicenseList;
                            cz = false;
                            break;
                        }
                    }
                    if (cz) {
                        //Input 页面需要 去操作List页面的数组 parent
                        parent.$ContractorPersonnelDirectory.EquipmenFacilities.push({
                            id: thisuser.id,
                            ContractorName: thisuser.ContractorName,
                            PrincipalName: thisuser.PrincipalName,
                            contact: thisuser.contact,
                            Qualification: thisuser.Qualification,
                            QualificationLevel: thisuser.QualificationLevel,
                            Administration: thisuser.Administration,
                            ConstructionCategory: thisuser.ConstructionCategory,
                            TechnicalStaffSituation: thisuser.TechnicalStaffSituation,
                            MainaAchievement: thisuser.MainaAchievement,


                            EmploymentLicenseList: thisuser.EmploymentLicenseList
                        });
                    }
                    return {
                        result: "Success",
                        message: null,
                        data: null
                    };
                });
                break;
        }
    },
    EquipmenFacilities: [],
    InitArray: function () {
        for (var i = 0; i < 80; i++) {
            $BlackContractorDirectoryManagement.EquipmenFacilities.push(Mock.mock({
                id: Mock.Random.id(),
                ContractorName: randomValue("139"), //承包商名称
                PrincipalName: Mock.Random.cname(), //负责人姓名
                contact: randomValue("n64"), //联系方式
                Age: Mock.mock('@integer(25, 50)'),
                // Qualification: Mock.mock('@cparagraph(1, 1)'),//资质
                Qualification: '', //资质
                IDNumber: Mock.mock('@float(0)'),
                ConstructionCategory: randomValue("25"),
                SupervisorManufacturer: randomValue("chy1"), //主管厂家
                Administration: randomValue("08"),
                QualificationLevel: Mock.mock('@integer(1, 5)'),
                // TechnicalStaffSituation: Mock.mock('@cparagraph(1, 1)'),
                TechnicalStaffSituation: '',
                // MainaAchievement: Mock.mock('@cparagraph(1, 1)'),//主要业绩
                MainaAchievement: '', //主要业绩
                EmploymentLicenseList: [{
                    LicenseName: Mock.Random.cname(),
                    BeginTime: Mock.mock('@datetime()'),
                    EndTime: Mock.mock('@datetime()'),
                    EditorTime: Mock.mock('@datetime()'),
                    EditorPeople: Mock.Random.cname(),

                }],
            }));

        }
    }
}

//<!--承包商人员名录管理-->
var $ContractorPersonnelDirectory = {
    DealUrl: function (vueApp, url, type, param) {
        var my = vueApp;
        switch (url) {
            ////删除
            case '/api/ContractorPersonnelDirectory/DeleteMuti':
                Mock.mock(host + url, type, function (options) {
                    var delIDs = options.body;
                    var temp = [];
                    for (var i = 0; i < $ContractorPersonnelDirectory.EquipmenFacilities.length; i++) {
                        temp.push($ContractorPersonnelDirectory.EquipmenFacilities[i]);
                    }
                    for (var i = 0; i < temp.length; i++) {
                        if (delIDs.includes(temp[i].id)) {
                            $ContractorPersonnelDirectory.EquipmenFacilities.splice(temp[i], 1);
                        }
                    }
                    return {
                        result: "Success",
                        message: null,
                        data: null
                    };
                });
                break;
                //获取List数据
            case '/api/ContractorPersonnelDirectory/GetList':
                Mock.mock(host + url, type,
                    function (options) {
                        if ($ContractorPersonnelDirectory.EquipmenFacilities.length == 0) {
                            $ContractorPersonnelDirectory.InitArray();
                        }
                        var p = JSON.parse(options.body);
                        //条件
                        var PersonnelName = p.model.PersonnelName;
                        var ContractorName = p.model.ContractorName;
                        var ConstructionCategory = getDicValue("25", p.model.ConstructionCategory);
                        //分页
                        var offset = p.offset;
                        var limit = p.limit;
                        var limitUsers2 = [];
                        for (var i = 0; i < $ContractorPersonnelDirectory.EquipmenFacilities.length; i++) {
                            var user = $ContractorPersonnelDirectory.EquipmenFacilities[i];
                            if (PersonnelName && user.PersonnelName.indexOf(PersonnelName) == -1)
                                continue;
                            if (ContractorName && user.ContractorName.indexOf(ContractorName) == -1)
                                continue;
                            if (ConstructionCategory && user.ConstructionCategory.indexOf(ConstructionCategory) == -1)
                                continue;
                            user.ConstructionCategory = getDicValue("25", user.ConstructionCategory) == '' ? user.ConstructionCategory : getDicValue("25", user.ConstructionCategory);
                            user.sex = getDicValue("01", user.sex) == '' ? user.sex : getDicValue("01", user.sex);
                            limitUsers2.push(user);
                        }

                        var limitUsers = [];
                        for (var i = 0; i < limitUsers2.length; i++) {
                            if (i < offset + limit && i >= offset) {
                                limitUsers.push(limitUsers2[i]);
                            }
                        }
                        return {
                            result: "Success",
                            message: null,
                            data: {
                                pageData: limitUsers,
                                rowCount: limitUsers2.length
                            }
                        };
                    });
                break;
                ////获取Input数据
            case '/api/ContractorPersonnelDirectory/get':
                Mock.mock(host + url + '?' + param, type, function (options) {

                    var myUsers = parent.$ContractorPersonnelDirectory.EquipmenFacilities;
                    myuser = {};
                    for (var i = 0; i < myUsers.length; i++) {
                        if (myUsers[i].id == vueApp.id) {
                            myuser = myUsers[i];
                            break;
                        }
                    }
                    myuser.ConstructionCategory = getDicKey("25", myuser.ConstructionCategory);
                    return {
                        result: "Success",
                        message: null,
                        data: myuser
                    };
                });
                break;
                ////提交
            case '/api/ContractorPersonnelDirectory/Save':
                Mock.mock(host + url, type, function (options) {
                    var thisuser = JSON.parse(options.body);
                    var thisUsers = parent.$ContractorPersonnelDirectory.EquipmenFacilities;
                    var cz = true;
                    for (var i = 0; i < thisUsers.length; i++) {
                        if (thisUsers[i].id == thisuser.id) {
                            thisUsers[i].PersonnelName = thisuser.PersonnelName;
                            thisUsers[i].sex = thisuser.sex;
                            thisUsers[i].phone = thisuser.phone;
                            thisUsers[i].YearMonth = thisuser.YearMonth;
                            thisUsers[i].ContractorName = thisuser.ContractorName;
                            thisUsers[i].IDNumber = thisuser.IDNumber;
                            thisUsers[i].MainaAchievement = thisuser.MainaAchievement;
                            thisUsers[i].ConstructionCategory = thisuser.ConstructionCategory;
                            thisUsers[i].EmploymentLicenseList = thisuser.EmploymentLicenseList;
                            cz = false;
                            break;
                        }
                    }
                    if (cz) {
                        //Input 页面需要 去操作List页面的数组 parent
                        parent.$ContractorPersonnelDirectory.EquipmenFacilities.push({
                            id: thisuser.id,
                            PersonnelName: thisuser.PersonnelName,
                            sex: thisuser.sex,
                            phone: thisuser.phone,
                            YearMonth: thisuser.YearMonth,
                            ContractorName: thisuser.ContractorName,
                            IDNumber: thisuser.IDNumber,
                            MainaAchievement: thisuser.MainaAchievement,
                            ConstructionCategory: thisuser.ConstructionCategory,
                            editor: Mock.Random.cname(),
                            editorTime: Mock.mock('@datetime()'),
                            EmploymentLicenseList: thisuser.EmploymentLicenseList
                        });
                    }
                    return {
                        result: "Success",
                        message: null,
                        data: null
                    };
                });
                break;
        }
    },
    EquipmenFacilities: [],
    InitArray: function () {
        for (var i = 0; i < 80; i++) {
            $ContractorPersonnelDirectory.EquipmenFacilities.push(Mock.mock({
                id: Mock.Random.id(),
                PersonnelName: Mock.Random.cname(), //姓名
                sex: randomValue('01'), //性别
                Age: Mock.mock({
                    "number|25-60": 60
                }).number, //年龄
                YearMonth: Mock.Random.date('yyyy-MM'),
                phone: randomValue("n64"), //电话号
                work: randomValue("n110"), //电话号
                ContractorName: randomValue("139"), //承包商名称
                IDNumber: Mock.Random.id(), //身份证
                ConstructionCategory: randomValue("25"), //施工类别
                // MainaAchievement: Mock.mock('@cparagraph(1, 1)'),//主要业绩
                MainaAchievement: '', //主要业绩
                editor: Mock.Random.cname(),
                editorTime: Mock.mock('@datetime()'),
                EmploymentLicenseList: [{
                    LicenseName: Mock.Random.cname(),
                    BeginTime: Mock.mock('@datetime()'),
                    EndTime: Mock.mock('@datetime()'),
                    EditorTime: Mock.mock('@datetime()'),
                }],
            }));
        }
    }
}
//<!--承包商人员名录管理 黑名单-->
var $BlackContractorPersonnelDirectoryManagement = {
    DealUrl: function (vueApp, url, type, param) {
        var my = vueApp;
        switch (url) {
            ////删除
            case '/api/BlackContractorPersonnelDirectoryManagement/DeleteMuti':
                Mock.mock(host + url, type, function (options) {
                    var delIDs = options.body;
                    var temp = [];
                    for (var i = 0; i < $BlackContractorPersonnelDirectoryManagement.EquipmenFacilities.length; i++) {
                        temp.push($BlackContractorPersonnelDirectoryManagement.EquipmenFacilities[i]);
                    }
                    for (var i = 0; i < temp.length; i++) {
                        if (delIDs.includes(temp[i].id)) {
                            $BlackContractorPersonnelDirectoryManagement.EquipmenFacilities.splice(temp[i], 1);
                        }
                    }
                    return {
                        result: "Success",
                        message: null,
                        data: null
                    };
                });
                break;
                //获取List数据
            case '/api/BlackContractorPersonnelDirectoryManagement/GetList':
                Mock.mock(host + url, type,
                    function (options) {
                        if ($BlackContractorPersonnelDirectoryManagement.EquipmenFacilities.length == 0) {
                            $BlackContractorPersonnelDirectoryManagement.InitArray();
                        }
                        var p = JSON.parse(options.body);
                        //条件
                        var PersonnelName = p.model.PersonnelName;
                        var ContractorName = p.model.ContractorName;
                        var ConstructionCategory = getDicValue("25", p.model.ConstructionCategory);
                        //分页
                        var offset = p.offset;
                        var limit = p.limit;
                        var limitUsers2 = [];
                        for (var i = 0; i < $BlackContractorPersonnelDirectoryManagement.EquipmenFacilities.length; i++) {
                            var user = $BlackContractorPersonnelDirectoryManagement.EquipmenFacilities[i];
                            if (PersonnelName && user.PersonnelName.indexOf(PersonnelName) == -1)
                                continue;
                            if (ContractorName && user.ContractorName.indexOf(ContractorName) == -1)
                                continue;
                            if (ConstructionCategory && user.ConstructionCategory.indexOf(ConstructionCategory) == -1)
                                continue;
                            user.ConstructionCategory = getDicValue("25", user.ConstructionCategory) == '' ? user.ConstructionCategory : getDicValue("25", user.ConstructionCategory);
                            user.sex = getDicValue("01", user.sex) == '' ? user.sex : getDicValue("01", user.sex);
                            limitUsers2.push(user);
                        }

                        var limitUsers = [];
                        for (var i = 0; i < limitUsers2.length; i++) {
                            if (i < offset + limit && i >= offset) {
                                limitUsers.push(limitUsers2[i]);
                            }
                        }
                        return {
                            result: "Success",
                            message: null,
                            data: {
                                pageData: limitUsers,
                                rowCount: limitUsers2.length
                            }
                        };
                    });
                break;
                ////获取Input数据
            case '/api/BlackContractorPersonnelDirectoryManagement/get':
                Mock.mock(host + url + '?' + param, type, function (options) {

                    var myUsers = parent.$BlackContractorPersonnelDirectoryManagement.EquipmenFacilities;
                    myuser = {};
                    for (var i = 0; i < myUsers.length; i++) {
                        if (myUsers[i].id == vueApp.id) {
                            myuser = myUsers[i];
                            break;
                        }
                    }
                    myuser.ConstructionCategory = getDicKey("25", myuser.ConstructionCategory);
                    return {
                        result: "Success",
                        message: null,
                        data: myuser
                    };
                });
                break;
                ////提交
            case '/api/BlackContractorPersonnelDirectoryManagement/Save':
                Mock.mock(host + url, type, function (options) {
                    var thisuser = JSON.parse(options.body);
                    var thisUsers = parent.$BlackContractorPersonnelDirectoryManagement.EquipmenFacilities;
                    var cz = true;
                    for (var i = 0; i < thisUsers.length; i++) {
                        if (thisUsers[i].id == thisuser.id) {
                            thisUsers[i].PersonnelName = thisuser.PersonnelName;
                            thisUsers[i].sex = thisuser.sex;
                            thisUsers[i].YearMonth = thisuser.YearMonth;
                            thisUsers[i].phone = thisuser.phone;
                            thisUsers[i].ContractorName = thisuser.ContractorName;
                            thisUsers[i].IDNumber = thisuser.IDNumber;
                            thisUsers[i].MainaAchievement = thisuser.MainaAchievement;
                            thisUsers[i].ConstructionCategory = thisuser.ConstructionCategory;
                            thisUsers[i].EmploymentLicenseList = thisuser.EmploymentLicenseList;
                            cz = false;
                            break;
                        }
                    }
                    if (cz) {
                        //Input 页面需要 去操作List页面的数组 parent
                        parent.$BlackContractorPersonnelDirectoryManagement.EquipmenFacilities.push({
                            id: thisuser.id,
                            PersonnelName: thisuser.PersonnelName,
                            sex: thisuser.sex,
                            YearMonth: thisuser.YearMonth,
                            phone: thisuser.phone,
                            ContractorName: thisuser.ContractorName,
                            IDNumber: thisuser.IDNumber,
                            MainaAchievement: thisuser.MainaAchievement,
                            ConstructionCategory: thisuser.ConstructionCategory,
                            editor: Mock.Random.cname(),
                            editorTime: Mock.mock('@datetime()'),
                            EmploymentLicenseList: thisuser.EmploymentLicenseList
                        });
                    }
                    return {
                        result: "Success",
                        message: null,
                        data: null
                    };
                });
                break;
        }
    },
    EquipmenFacilities: [],
    InitArray: function () {
        for (var i = 0; i < 80; i++) {
            $BlackContractorPersonnelDirectoryManagement.EquipmenFacilities.push(Mock.mock({
                id: Mock.Random.id(),
                PersonnelName: Mock.Random.cname(), //姓名
                sex: randomValue('01'), //性别
                Age: Mock.mock({
                    "number|25-60": 60
                }).number, //年龄
                work: randomValue("n110"), //电话号
                YearMonth: Mock.Random.date('yyyy-MM'),
                phone: randomValue("n64"), //电话号
                ContractorName: randomValue("139"), //承包商名称
                IDNumber: Mock.Random.id(), //身份证
                ConstructionCategory: randomValue("25"), //施工类别
                // MainaAchievement: Mock.mock('@cparagraph(1, 1)'),//主要业绩
                MainaAchievement: '', //主要业绩
                editor: Mock.Random.cname(),
                editorTime: Mock.mock('@datetime()'),
                EmploymentLicenseList: [{
                    LicenseName: Mock.Random.cname(),
                    BeginTime: Mock.mock('@datetime()'),
                    EndTime: Mock.mock('@datetime()'),
                    EditorTime: Mock.mock('@datetime()'),
                }],
            }));
        }
    }
}

//<!--承包商入场工具管理-->
var $ContractorAdmissionTool = {
    DealUrl: function (vueApp, url, type, param) {
        var my = vueApp;
        switch (url) {
            ////删除
            case '/api/ContractorAdmissionTool/DeleteMuti':
                Mock.mock(host + url, type, function (options) {
                    var delIDs = options.body;
                    var temp = [];
                    for (var i = 0; i < $ContractorAdmissionTool.EquipmenFacilities.length; i++) {
                        temp.push($ContractorAdmissionTool.EquipmenFacilities[i]);
                    }
                    for (var i = 0; i < temp.length; i++) {
                        if (delIDs.includes(temp[i].id)) {
                            $ContractorAdmissionTool.EquipmenFacilities.splice(temp[i], 1);
                        }
                    }
                    return {
                        result: "Success",
                        message: null,
                        data: null
                    };
                });
                break;
                //获取List数据
            case '/api/ContractorAdmissionTool/GetList':
                Mock.mock(host + url, type,
                    function (options) {
                        if ($ContractorAdmissionTool.EquipmenFacilities.length == 0) {
                            $ContractorAdmissionTool.InitArray();
                        }

                        var p = JSON.parse(options.body);
                        //条件

                        var ContractorName = p.model.ContractorName;

                        //分页
                        var offset = p.offset;
                        var limit = p.limit;
                        var limitUsers2 = [];
                        for (var i = 0; i < $ContractorAdmissionTool.EquipmenFacilities.length; i++) {
                            var user = $ContractorAdmissionTool.EquipmenFacilities[i];
                            if (ContractorName && user.ContractorName.indexOf(ContractorName) == -1)
                                continue;
                            user.status = getDicValue("51", user.status) == '' ? user.status : getDicValue("51", user.status);
                            limitUsers2.push(user);
                        }

                        var limitUsers = [];
                        for (var i = 0; i < limitUsers2.length; i++) {
                            if (i < offset + limit && i >= offset) {
                                limitUsers.push(limitUsers2[i]);
                            }
                        }
                        return {
                            result: "Success",
                            message: null,
                            data: {
                                pageData: limitUsers,
                                rowCount: limitUsers2.length
                            }
                        };
                    });
                break;
                ////获取Input数据
            case '/api/ContractorAdmissionTool/get':
                Mock.mock(host + url + '?' + param, type, function (options) {

                    var myUsers = parent.$ContractorAdmissionTool.EquipmenFacilities;
                    myuser = {};
                    for (var i = 0; i < myUsers.length; i++) {
                        if (myUsers[i].id == vueApp.id) {
                            myuser = myUsers[i];
                            break;
                        }
                    }
                    return {
                        result: "Success",
                        message: null,
                        data: myuser
                    };
                });
                break;
            case '/api/ContractorAdmissionTool/getxiaohe':
                Mock.mock(host + url + '?' + param, type, function (options) {
                    var myUsers = parent.parent.$ContractorAdmissionTool.EquipmenFacilities;
                    myuser = {};
                    for (var i = 0; i < myUsers.length; i++) {
                        var a = myUsers[i].CarryingToolList;
                        for (var j = 0; j < a.length; j++) {
                            if (a[j].id == vueApp.id) {
                                myuser = a[j];
                                break;
                            }
                        }
                    }
                    return {
                        result: "Success",
                        message: null,
                        data: myuser
                    };
                });
                break;
                ////提交
            case '/api/ContractorAdmissionTool/Save':
                Mock.mock(host + url, type, function (options) {
                    var thisuser = JSON.parse(options.body);
                    var thisUsers = parent.$ContractorAdmissionTool.EquipmenFacilities;

                    var cz = true;
                    for (var i = 0; i < thisUsers.length; i++) {
                        var a = thisUsers[i].CarryingToolList;
                        if (thisUsers[i].id == thisuser.id) {
                            thisUsers[i].ContractorName = thisuser.ContractorName;

                            for (var j = 0; j < a.length; j++) {
                                if (parseInt(thisuser.CarryingToolList[j].ThisOutCarryingQuantity) > 0) {
                                    a[j].PinCoreList.push({
                                        DepartureTime: '2018-08-08',
                                        SituationStatement: thisuser.CarryingToolList[j].SituationStatement,
                                        OutCarryingQuantity: parseInt(thisuser.CarryingToolList[j].ThisOutCarryingQuantity),
                                    })
                                }
                                a[j].OutCarryingQuantity = parseInt(a[j].OutCarryingQuantity) + parseInt(thisuser.CarryingToolList[j].ThisOutCarryingQuantity);
                                a[j].ThisOutCarryingQuantity = 0;
                                a[j].ThisInCarryingQuantity = 0;
                                a[j].OutCarryingQuantityEd = 0;
                                a[j].SituationStatement = thisuser.CarryingToolList[j].SituationStatement;
                                a[j].DepartureTime = '2018-08-08';
                            }
                            cz = false;
                            break;
                        }
                    }
                    if (cz) {
                        //Input 页面需要 去操作List页面的数组 parent
                        parent.$ContractorAdmissionTool.EquipmenFacilities.push({
                            id: thisuser.id,
                            PersonnelName: thisuser.PersonnelName,
                            CarryingToolName: thisuser.CarryingToolName,
                            ToolInspector: thisuser.ToolInspector,
                            CarryingToolQuantity: thisuser.CarryingToolQuantity,
                            phone: thisuser.phone,
                            ContractorName: thisuser.ContractorName,
                            IsConsumables: thisuser.IsConsumables,
                            ArrivalTime: thisuser.ArrivalTime,
                            SituationStatement: thisuser.SituationStatement,
                            OutCarryingQuantity: thisuser.OutCarryingQuantity,
                            InCarryingQuantity: thisuser.InCarryingQuantity,
                            OutCarryingQuantityEd: thisuser.OutCarryingQuantityEd,
                            DepartureTime: thisuser.DepartureTime,
                            status: randomValue("51"),
                            CarryingToolList: thisuser.CarryingToolList,
                        });
                    }
                    return {
                        result: "Success",
                        message: null,
                        data: null
                    };
                });
                break;
        }
    },
    EquipmenFacilities: [],
    InitArray: function () {
        for (var i = 0; i < 80; i++) {
            var ID = Mock.Random.id();
            $ContractorAdmissionTool.EquipmenFacilities.push(Mock.mock({
                id: ID,
                PersonnelName: Mock.Random.cname(), //姓名
                CarryingToolName: randomValue("CarryingToolName"), //携带工具名称
                ToolInspector: Mock.Random.cname(), //工器具检查人
                CarryingToolQuantity: Mock.mock('@natural(10, 20)'), //入场携带工具数量
                phone: Mock.Random.string('number', 11), //电话号
                ContractorName: randomValue("139"), //承包商名称
                ArrivalTime: Mock.Random.datetime(), //进场时间
                InCarryingQuantity: Mock.mock('@natural(1, 10)'), //进场携带工具数量
                OutCarryingQuantityEd: Mock.mock('@natural(1, 10)'), //已出场数量
                IsConsumables: randomValue("50"), //是否为消耗品
                SituationStatement: Mock.mock('@cword("零一二三四五六七八九十", 5, 7)'), //情况说明
                OutCarryingQuantity: Mock.mock('@natural(1, 10)'), //出场携带工具数量
                DepartureTime: Mock.Random.datetime(), //离场时间
                status: randomValue("51"), //状态
                CarryingToolList: [{
                    CarryingToolName: randomValue("CarryingToolName"),
                    InCarryingQuantity: Mock.mock('@natural(1, 10)'), //进场携带工具数量
                    OutCarryingQuantityEd: Mock.mock('@natural(1, 10)'), //已出场数量
                    IsConsumables: randomValue("50"), //是否为消耗品
                    CarryingToolQuantity: Mock.mock('@natural(1, 20)'),
                    ArrivalTime: Mock.Random.datetime(),
                    OutCarryingQuantity: Mock.mock('@natural(1, 10)'),
                    ThisOutCarryingQuantity: 0,
                    SituationStatement: Mock.mock('@cword("零一二三四五六七八九十", 5, 7)'),
                    OutCarryingQuantity: Mock.mock('@natural(1, 10)'),
                    id: Mock.Random.id(),
                    pid: ID,
                    DepartureTime: Mock.Random.datetime(),
                    PinCoreList: [] //销核列表
                }],

            }));
        }
    }
}

///培训课件类型
var $TrainingCoursewareType = {
    DealUrl: function (vueApp, url, type, param) {
        var my = vueApp;
        switch (url) {
            ////删除
            case '/api/TrainingCoursewareType/DeleteMuti':
                Mock.mock(host + url, type, function (options) {
                    var delIDs = options.body;
                    var temp = [];
                    for (var i = 0; i < $TrainingCoursewareType.EquipmenFacilities.length; i++) {
                        temp.push($TrainingCoursewareType.EquipmenFacilities[i]);
                    }
                    for (var i = 0; i < temp.length; i++) {
                        if (delIDs.includes(temp[i].id)) {
                            $TrainingCoursewareType.EquipmenFacilities.splice(temp[i], 1);
                        }
                    }
                    return {
                        result: "Success",
                        message: null,
                        data: null
                    };
                });
                break;
                //获取List数据
            case '/api/TrainingCoursewareType/GetList':
                Mock.mock(host + url, type,
                    function (options) {
                        if ($TrainingCoursewareType.EquipmenFacilities.length == 0) {
                            $TrainingCoursewareType.InitArray();
                        }
                        var p = JSON.parse(options.body);
                        //条件
                        var TrainingCoursewareTypeName = p.model.TrainingCoursewareTypeName;
                        //分页
                        var offset = p.offset;
                        var limit = p.limit;
                        var limitUsers2 = [];
                        for (var i = 0; i < $TrainingCoursewareType.EquipmenFacilities.length; i++) {
                            var user = $TrainingCoursewareType.EquipmenFacilities[i];
                            if (TrainingCoursewareTypeName && user.TrainingCoursewareTypeName.indexOf(TrainingCoursewareTypeName) == -1)
                                continue;
                            limitUsers2.push(user);
                        }
                        var limitUsers = [];
                        for (var i = 0; i < limitUsers2.length; i++) {
                            if (i < offset + limit && i >= offset) {
                                limitUsers.push(limitUsers2[i]);
                            }
                        }
                        return {
                            result: "Success",
                            message: null,
                            data: {
                                pageData: limitUsers,
                                rowCount: limitUsers2.length
                            }
                        };
                    });
                break;
                ////获取Input数据
            case '/api/TrainingCoursewareType/get':
                Mock.mock(host + url + '?' + param, type, function (options) {

                    var myUsers = parent.$TrainingCoursewareType.EquipmenFacilities;
                    myuser = {};
                    for (var i = 0; i < myUsers.length; i++) {
                        if (myUsers[i].id == vueApp.id) {
                            myuser = myUsers[i];
                            break;
                        }
                    }
                    return {
                        result: "Success",
                        message: null,
                        data: myuser
                    };
                });
                break;
                ////提交
            case '/api/TrainingCoursewareType/Save':
                Mock.mock(host + url, type, function (options) {
                    var thisuser = JSON.parse(options.body);
                    var thisUsers = parent.$TrainingCoursewareType.EquipmenFacilities;
                    var cz = true;
                    for (var i = 0; i < thisUsers.length; i++) {
                        if (thisUsers[i].id == thisuser.id) {
                            thisUsers[i].TrainingCoursewareTypeName = thisuser.TrainingCoursewareTypeName;
                            thisUsers[i].editor = Mock.Random.cname(),
                                thisUsers[i].editorTime = Mock.Random.datetime(), //编辑时间
                                cz = false;
                            break;
                        }
                    }
                    if (cz) {
                        //Input 页面需要 去操作List页面的数组 parent
                        parent.$TrainingCoursewareType.EquipmenFacilities.push({
                            id: thisuser.id,
                            TrainingCoursewareTypeName: thisuser.TrainingCoursewareTypeName,
                            editor: Mock.Random.cname(),
                            editorTime: Mock.Random.datetime(), //编辑时间
                        });
                    }
                    return {
                        result: "Success",
                        message: null,
                        data: null
                    };
                });
                break;
        }
    },
    EquipmenFacilities: [],
    InitArray: function () {
        for (var i = 0; i < 15; i++) {
            $TrainingCoursewareType.EquipmenFacilities.push(Mock.mock({
                id: Mock.Random.id(),
                TrainingCoursewareTypeName: randomValue("27"), //姓名
                editor: Mock.Random.cname(), //编辑人
                editorTime: Mock.Random.datetime(), //编辑时间
            }));
        }
    }
}

//培训课件
var $TrainingCourseware = {
    DealUrl: function (vueApp, url, type, param) {
        var my = vueApp;
        switch (url) {
            ////删除
            case '/api/TrainingCourseware/DeleteMuti':
                Mock.mock(host + url, type, function (options) {
                    var delIDs = options.body;
                    var temp = [];
                    for (var i = 0; i < $TrainingCourseware.EquipmenFacilities.length; i++) {
                        temp.push($TrainingCourseware.EquipmenFacilities[i]);
                    }
                    for (var i = 0; i < temp.length; i++) {
                        if (delIDs.includes(temp[i].id)) {
                            $TrainingCourseware.EquipmenFacilities.splice(temp[i], 1);
                        }
                    }
                    return {
                        result: "Success",
                        message: null,
                        data: null
                    };
                });
                break;
                //获取List数据
            case '/api/TrainingCourseware/GetList':
                Mock.mock(host + url, type,
                    function (options) {
                        if ($TrainingCourseware.EquipmenFacilities.length == 0) {
                            $TrainingCourseware.InitArray();
                        }
                        var p = JSON.parse(options.body);
                        //条件
                        var TrainingCoursewareName = p.model.TrainingCoursewareName;

                        var TrainingCoursewareTypeName = getDicValue("27", p.model.TrainingCoursewareTypeName);
                        //分页
                        var offset = p.offset;
                        var limit = p.limit;
                        var limitUsers2 = [];
                        for (var i = 0; i < $TrainingCourseware.EquipmenFacilities.length; i++) {
                            var user = $TrainingCourseware.EquipmenFacilities[i];
                            if (TrainingCoursewareTypeName && user.TrainingCoursewareTypeName.indexOf(TrainingCoursewareTypeName) == -1)
                                continue;
                            if (TrainingCoursewareName && user.TrainingCoursewareName.indexOf(TrainingCoursewareName) == -1)
                                continue;
                            user.TrainingCoursewareTypeName = getDicValue("27", user.TrainingCoursewareTypeName) == '' ? user.TrainingCoursewareTypeName : getDicValue("27", user.TrainingCoursewareTypeName);
                            limitUsers2.push(user);
                        }
                        var limitUsers = [];
                        for (var i = 0; i < limitUsers2.length; i++) {
                            if (i < offset + limit && i >= offset) {
                                limitUsers.push(limitUsers2[i]);
                            }
                        }
                        return {
                            result: "Success",
                            message: null,
                            data: {
                                pageData: limitUsers,
                                rowCount: limitUsers2.length
                            }
                        };
                    });
                break;
                ////获取Input数据
            case '/api/TrainingCourseware/get':
                Mock.mock(host + url + '?' + param, type, function (options) {

                    var myUsers = parent.$TrainingCourseware.EquipmenFacilities;
                    myuser = {};
                    for (var i = 0; i < myUsers.length; i++) {
                        if (myUsers[i].id == vueApp.id) {
                            myuser = myUsers[i];
                            break;
                        }
                    }
                    myuser.TrainingCoursewareTypeName = getDicKey("27", myuser.TrainingCoursewareTypeName);
                    return {
                        result: "Success",
                        message: null,
                        data: myuser
                    };
                });
                break;
                ////提交
            case '/api/TrainingCourseware/Save':
                Mock.mock(host + url, type, function (options) {
                    var thisuser = JSON.parse(options.body);
                    var thisUsers = parent.$TrainingCourseware.EquipmenFacilities;
                    var cz = true;
                    for (var i = 0; i < thisUsers.length; i++) {
                        if (thisUsers[i].id == thisuser.id) {
                            thisUsers[i].TrainingCoursewareTypeName = thisuser.TrainingCoursewareTypeName;
                            thisUsers[i].TrainingCoursewareName = thisuser.TrainingCoursewareName;
                            thisUsers[i].TrainingCoursewareContentSummary = thisuser.TrainingCoursewareContentSummary;
                            thisUsers[i].editor = Mock.Random.cname(),
                                thisUsers[i].editorTime = Mock.Random.datetime(), //编辑时间
                                cz = false;
                            break;
                        }
                    }
                    if (cz) {
                        //Input 页面需要 去操作List页面的数组 parent
                        parent.$TrainingCourseware.EquipmenFacilities.push({
                            id: thisuser.id,
                            TrainingCoursewareTypeName: thisuser.TrainingCoursewareTypeName,
                            TrainingCoursewareName: thisuser.TrainingCoursewareName,
                            TrainingCoursewareContentSummary: thisuser.TrainingCoursewareContentSummary,
                            editor: Mock.Random.cname(),
                            editorTime: Mock.Random.datetime(), //编辑时间
                        });
                    }
                    return {
                        result: "Success",
                        message: null,
                        data: null
                    };
                });
                break;
        }
    },
    EquipmenFacilities: [],
    InitArray: function () {
        for (var i = 0; i < 15; i++) {
            $TrainingCourseware.EquipmenFacilities.push(Mock.mock({
                id: Mock.Random.id(),
                TrainingCoursewareTypeName: randomValue("27"), //课件类型
                editor: Mock.Random.cname(), //编辑人
                editorTime: Mock.Random.datetime(), //编辑时间
                TrainingCoursewareName: randomValue("chy2"),
                TrainingCoursewareContentSummary: Mock.mock('@cparagraph(1, 1)'),
            }));
        }
    }
}

//培训记录管理
var $TrainingRecord = {
    DealUrl: function (vueApp, url, type, param) {
        var my = vueApp;

        switch (url) {
            ////删除
            case '/api/TrainingRecord/DeleteMuti':
                Mock.mock(host + url, type, function (options) {
                    var delIDs = options.body;
                    var temp = [];
                    for (var i = 0; i < $TrainingRecord.EquipmenFacilities.length; i++) {
                        temp.push($TrainingRecord.EquipmenFacilities[i]);
                    }
                    for (var i = 0; i < temp.length; i++) {
                        if (delIDs.includes(temp[i].id)) {
                            $TrainingRecord.EquipmenFacilities.splice(temp[i], 1);
                        }
                    }
                    return {
                        result: "Success",
                        message: null,
                        data: null
                    };
                });
                break;
                //获取List数据
            case '/api/TrainingRecord/GetList':
                Mock.mock(host + url, type,
                    function (options) {
                        if ($TrainingRecord.EquipmenFacilities.length == 0) {
                            $TrainingRecord.InitArray();
                        }
                        var p = JSON.parse(options.body);
                        //条件
                        var TrainingCoursewareName = getDicValue("54", p.model.TrainingCoursewareName);
                        var Type = getDicValue("n101", p.model.Type);
                        //分页
                        var offset = p.offset;
                        var limit = p.limit;
                        var limitUsers2 = [];
                        for (var i = 0; i < $TrainingRecord.EquipmenFacilities.length; i++) {
                            var user = $TrainingRecord.EquipmenFacilities[i];
                            if (TrainingCoursewareName && user.TrainingCoursewareName.indexOf(TrainingCoursewareName) == -1)
                                continue;
                            user.TrainingCoursewareName = getDicValue("54", user.TrainingCoursewareName) == '' ? user.TrainingCoursewareName : getDicValue("54", user.TrainingCoursewareName);
                            if (Type && user.Type.indexOf(Type) == -1)
                                continue;
                            user.Type = getDicValue("54", user.Type) == '' ? user.Type : getDicValue("n101", user.Type);
                            limitUsers2.push(user);
                        }
                        var limitUsers = [];
                        for (var i = 0; i < limitUsers2.length; i++) {
                            if (i < offset + limit && i >= offset) {
                                limitUsers.push(limitUsers2[i]);
                            }
                        }
                        return {
                            result: "Success",
                            message: null,
                            data: {
                                pageData: limitUsers,
                                rowCount: limitUsers2.length
                            }
                        };
                    });
                break;
                ////获取Input数据
            case '/api/TrainingRecord/get':
                Mock.mock(host + url + '?' + param, type, function (options) {
                    var myUsers = parent.$TrainingRecord.EquipmenFacilities;
                    myuser = {};
                    for (var i = 0; i < myUsers.length; i++) {
                        if (myUsers[i].id == vueApp.id) {
                            myuser = myUsers[i];
                            break;
                        }
                    }
                    myuser.TrainingCoursewareName = getDicKey("54", myuser.TrainingCoursewareName);
                    return {
                        result: "Success",
                        message: null,
                        data: myuser
                    };
                });
                break;
                ////提交
            case '/api/TrainingRecord/Save':
                Mock.mock(host + url, type, function (options) {
                    var thisuser = JSON.parse(options.body);
                    var thisUsers = parent.$TrainingRecord.EquipmenFacilities;
                    var cz = true;
                    for (var i = 0; i < thisUsers.length; i++) {
                        if (thisUsers[i].id == thisuser.id) {
                            thisUsers[i].TrainingDate = thisuser.TrainingDate;
                            thisUsers[i].TrainingCoursewareName = thisuser.TrainingCoursewareName;
                            thisUsers[i].Type = thisuser.Type;
                            thisUsers[i].Trainer = thisuser.Trainer;
                            thisUsers[i].contractor = thisuser.contractor;
                            thisUsers[i].participant = thisuser.participant;
                            thisUsers[i].Remarks = thisuser.Remarks;
                            thisUsers[i].Annex = thisuser.Annex;
                            thisUsers[i].editor = Mock.Random.cname(),
                                thisUsers[i].editorTime = Mock.Random.datetime(), //编辑时间
                                cz = false;
                            break;
                        }
                    }
                    if (cz) {
                        //Input 页面需要 去操作List页面的数组 parent
                        parent.$TrainingRecord.EquipmenFacilities.push({
                            id: thisuser.id,
                            TrainingDate: thisuser.TrainingDate,
                            TrainingCoursewareName: thisuser.TrainingCoursewareName,
                            Type: thisuser.Type,
                            Trainer: thisuser.Trainer,
                            contractor: thisuser.contractor,
                            participant: thisuser.participant,
                            Remarks: thisuser.Remarks,
                            Annex: thisuser.Annex,
                            editor: Mock.Random.cname(),
                            editorTime: Mock.Random.datetime(), //编辑时间


                        });
                    }
                    return {
                        result: "Success",
                        message: null,
                        data: null
                    };
                });
                break;
        }
    },
    EquipmenFacilities: [],
    InitArray: function () {
        for (var i = 0; i < 15; i++) {
            var PersonInChargePidA = randomTreeNode(PersonInChargeTree, '0', true);
            var PersonInChargePidB = randomTreeNode(PersonInChargeTree, '0', true);
            var PersonInChargeIdA = randomTreeNode(PersonInChargeTree, PersonInChargePidA);
            var PersonInChargeIdB = randomTreeNode(PersonInChargeTree, PersonInChargePidB);
            $TrainingRecord.EquipmenFacilities.push(Mock.mock({
                id: Mock.Random.id(),
                editor: Mock.Random.cname(), //编辑人
                editorTime: Mock.Random.date(), //编辑时间
                TrainingCoursewareName: randomValue("chy2"), // ,//培训课件名称
                Type: randomValue("n101"), //培训人
                Trainer: Mock.Random.cname(), //培训人
                TrainingDate: Mock.mock('@date()'), //培训日期
                contractor: randomValue("139"), //承包商
                // participant: Mock.mock('@cparagraph(1, 1)'), //参与人
                participant: [PersonInChargeIdA], //参与人
                Remarks: Mock.mock('@cparagraph(1, 1)'), // "备注"
                Annex: Mock.Random.cname() + "xml", //培训人
            }));
        }
    }
}

//试题管理
var $TestQuestions = {
    DealUrl: function (vueApp, url, type, param) {
        var my = vueApp;

        switch (url) {
            ////删除
            case '/api/TestQuestions/DeleteMuti':
                Mock.mock(host + url, type, function (options) {
                    var delIDs = options.body;
                    var temp = [];
                    for (var i = 0; i < $TestQuestions.EquipmenFacilities.length; i++) {
                        temp.push($TestQuestions.EquipmenFacilities[i]);
                    }
                    for (var i = 0; i < temp.length; i++) {
                        if (delIDs.includes(temp[i].id)) {
                            $TestQuestions.EquipmenFacilities.splice(temp[i], 1);
                        }
                    }
                    return {
                        result: "Success",
                        message: null,
                        data: null
                    };
                });
                break;
                //获取List数据
            case '/api/TestQuestions/GetList':
                Mock.mock(host + url, type,
                    function (options) {
                        if ($TestQuestions.EquipmenFacilities.length == 0) {
                            $TestQuestions.InitArray();
                        }
                        var p = JSON.parse(options.body);
                        var TreeNode = p.model.TreeNode;
                        //条件
                        //  var TrainingCoursewareName = getDicValue("54", p.model.TrainingCoursewareName);
                        //分页
                        var offset = p.offset;
                        var limit = p.limit;
                        var limitUsers2 = [];
                        for (var i = 0; i < $TestQuestions.EquipmenFacilities.length; i++) {
                            var user = $TestQuestions.EquipmenFacilities[i];
                            if (TreeNode && user.TreeNode.indexOf(TreeNode) == -1)
                                continue;
                            user.TestQuestionsType = getDicValue("28", user.TestQuestionsType) == '' ? user.TestQuestionsType : getDicValue("28", user.TestQuestionsType);
                            user.DegreeOfDifficulty = getDicValue("55", user.DegreeOfDifficulty) == '' ? user.DegreeOfDifficulty : getDicValue("55", user.DegreeOfDifficulty);
                            limitUsers2.push(user);
                        }
                        var limitUsers = [];
                        for (var i = 0; i < limitUsers2.length; i++) {
                            if (i < offset + limit && i >= offset) {
                                limitUsers.push(limitUsers2[i]);
                            }
                        }
                        return {
                            result: "Success",
                            message: null,
                            data: {
                                pageData: limitUsers,
                                rowCount: limitUsers2.length
                            }
                        };
                    });
                break;
                ////获取Input数据
            case '/api/TestQuestions/get':
                Mock.mock(host + url + '?' + param, type, function (options) {
                    var myUsers = parent.$TestQuestions.EquipmenFacilities;
                    myuser = {};
                    for (var i = 0; i < myUsers.length; i++) {
                        if (myUsers[i].id == vueApp.id) {
                            myuser = myUsers[i];
                            break;
                        }
                    }
                    myuser.TestQuestionsType = getDicKey("28", myuser.TestQuestionsType);
                    myuser.DegreeOfDifficulty = getDicKey("55", myuser.DegreeOfDifficulty);
                    return {
                        result: "Success",
                        message: null,
                        data: myuser
                    };
                });
                break;
                ////提交
            case '/api/TestQuestions/Save':
                Mock.mock(host + url, type, function (options) {
                    var thisuser = JSON.parse(options.body);
                    var thisUsers = parent.$TestQuestions.EquipmenFacilities;
                    var cz = true;
                    for (var i = 0; i < thisUsers.length; i++) {
                        if (thisUsers[i].id == thisuser.id) {
                            thisUsers[i].TestQuestionsContent = thisuser.TestQuestionsContent;
                            thisUsers[i].CoursewareType = getDicValue("56", thisuser.CoursewareID);
                            thisUsers[i].CoursewareID = thisuser.CoursewareID;
                            thisUsers[i].TestQuestionsType = thisuser.TestQuestionsType;
                            thisUsers[i].DegreeOfDifficulty = thisuser.DegreeOfDifficulty;
                            thisUsers[i].NumberOfOptions = thisuser.NumberOfOptions;
                            thisUsers[i].Answer = thisuser.Answer;
                            thisUsers[i].OptionsList = thisuser.OptionsList;
                            thisUsers[i].editor = Mock.Random.cname(),
                                thisUsers[i].editorTime = Mock.Random.datetime(), //编辑时间
                                thisUsers[i].TreeNode = Mock.Random.TreeNode(), //编辑时间
                                cz = false;
                            break;
                        }
                    }
                    if (cz) {
                        //Input 页面需要 去操作List页面的数组 parent
                        parent.$TestQuestions.EquipmenFacilities.push({
                            id: thisuser.id,
                            TestQuestionsContent: thisuser.TestQuestionsContent,
                            CoursewareType: getDicValue("56", thisuser.CoursewareID),
                            CoursewareID: thisuser.CoursewareID,
                            TestQuestionsType: thisuser.TestQuestionsType,
                            DegreeOfDifficulty: thisuser.DegreeOfDifficulty,
                            Answer: thisuser.Answer,
                            editor: Mock.Random.cname(),
                            editorTime: Mock.Random.datetime(), //编辑时间
                            NumberOfOptions: thisuser.NumberOfOptions,
                            OptionsList: thisuser.OptionsList,
                            TreeNode: thisuser.TreeNode,
                        });

                    }
                    return {
                        result: "Success",
                        message: null,
                        data: null
                    };
                });
                break;
        }
    },
    EquipmenFacilities: [],
    InitArray: function () {

        for (var i = 0; i < 15; i++) {
            var codeS = random(8, 15);
            var Number = random(2, 4);
            var answer = Mock.mock('@cword("ABCD", 1)');
            $TestQuestions.EquipmenFacilities.push(Mock.mock({
                id: Mock.Random.id(),
                editor: Mock.Random.cname(), //编辑人
                editorTime: Mock.Random.datetime(), //编辑时间
                TestQuestionsContent: randomValue("chy2"), // ,//试题内容
                CoursewareType: getDicValue("56", codeS), //课件类型
                CoursewareID: codeS, //课件类型ID
                TestQuestionsType: randomValue("28"), //试题类型
                DegreeOfDifficulty: randomValue("55"), //难易程度
                Answer: answer, //答案
                NumberOfOptions: Number,
                OptionsList: OptionsList(), //试题选项
                TreeNode: randomTreeNode(myTree)
            }));
        }
    }
}

function OptionsList() {
    var TestQuestionsOptionsList = [];
    for (var i = 0; i < 4; i++) {
        var OptionsList = {};
        OptionsList.OptionName = getDicValue("80", i);
        OptionsList.OptionComment = Mock.mock('@ctitle');
        OptionsList.IsAnswer = randomValue("50");
        TestQuestionsOptionsList.push(OptionsList);
    }
    return TestQuestionsOptionsList;
}



function random(lower, upper) {
    return Math.floor(Math.random() * (upper - lower)) + lower;
}

//考试成绩管理
var $ExaminationRecord = {
    DealUrl: function (vueApp, url, type, param) {
        var my = vueApp;
        switch (url) {
            ////删除
            case '/api/ExaminationRecord/DeleteMuti':
                Mock.mock(host + url, type, function (options) {
                    var delIDs = options.body;
                    var temp = [];
                    for (var i = 0; i < $ExaminationRecord.EquipmenFacilities.length; i++) {
                        temp.push($ExaminationRecord.EquipmenFacilities[i]);
                    }
                    for (var i = 0; i < temp.length; i++) {
                        if (delIDs.includes(temp[i].id)) {
                            $ExaminationRecord.EquipmenFacilities.splice(temp[i], 1);
                        }
                    }
                    return {
                        result: "Success",
                        message: null,
                        data: null
                    };
                });
                break;
                //获取List数据
            case '/api/ExaminationRecord/GetList':
                Mock.mock(host + url, type,
                    function (options) {
                        if ($ExaminationRecord.EquipmenFacilities.length == 0) {
                            $ExaminationRecord.InitArray();
                        }
                        var p = JSON.parse(options.body);
                        //条件
                        var ContractorName = p.model.ContractorName;
                        var Examiner = p.model.Examiner;
                        var TrainingCoursewareName = getDicValue("54", p.model.TrainingCoursewareName);
                        //分页
                        var offset = p.offset;
                        var limit = p.limit;
                        var limitUsers2 = [];
                        for (var i = 0; i < $ExaminationRecord.EquipmenFacilities.length; i++) {
                            var user = $ExaminationRecord.EquipmenFacilities[i];
                            if (Examiner && user.Examiner.indexOf(Examiner) == -1)
                                continue;
                            if (ContractorName && user.ContractorName.indexOf(ContractorName) == -1)
                                continue;
                            if (TrainingCoursewareName && user.TrainingCoursewareName.indexOf(TrainingCoursewareName) == -1)
                                continue;
                            user.TrainingCoursewareName = getDicValue("54", user.TrainingCoursewareName) == '' ? user.TrainingCoursewareName : getDicValue("54", user.TrainingCoursewareName);
                            user.IsPassed = getDicValue("57", user.IsPassed) == '' ? user.IsPassed : getDicValue("57", user.IsPassed);
                            limitUsers2.push(user);
                        }

                        var limitUsers = [];
                        for (var i = 0; i < limitUsers2.length; i++) {
                            if (i < offset + limit && i >= offset) {
                                limitUsers.push(limitUsers2[i]);
                            }
                        }
                        return {
                            result: "Success",
                            message: null,
                            data: {
                                pageData: limitUsers,
                                rowCount: limitUsers2.length
                            }
                        };
                    });
                break;
                ////获取Input数据
            case '/api/ExaminationRecord/get':
                Mock.mock(host + url + '?' + param, type, function (options) {

                    var myUsers = parent.$ExaminationRecord.EquipmenFacilities;
                    myuser = {};
                    for (var i = 0; i < myUsers.length; i++) {
                        if (myUsers[i].id == vueApp.id) {
                            myuser = myUsers[i];
                            break;
                        }
                    }
                    myuser.TrainingCoursewareName = getDicKey("54", myuser.TrainingCoursewareName);
                    myuser.IsPassed = getDicKey("57", myuser.IsPassed);
                    return {
                        result: "Success",
                        message: null,
                        data: myuser
                    };
                });
                break;
                ////提交
            case '/api/ExaminationRecord/Save':
                Mock.mock(host + url, type, function (options) {
                    var thisuser = JSON.parse(options.body);
                    var thisUsers = parent.$ExaminationRecord.EquipmenFacilities;
                    var cz = true;
                    for (var i = 0; i < thisUsers.length; i++) {
                        if (thisUsers[i].id == thisuser.id) {
                            thisUsers[i].IsPassed = thisuser.IsPassed;
                            thisUsers[i].TrainingCoursewareName = thisuser.TrainingCoursewareName;
                            thisUsers[i].ExaminationDate = thisuser.ExaminationDate;
                            thisUsers[i].DegreeOfDifficulty = thisuser.DegreeOfDifficulty;
                            thisUsers[i].Examiner = thisuser.Examiner;
                            thisUsers[i].ContractorName = thisuser.ContractorName;
                            thisUsers[i].Remarks = thisuser.Remarks;
                            thisUsers[i].ExaminationCategory = thisuser.ExaminationCategory;
                            thisUsers[i].Fraction = thisuser.Fraction;
                            thisUsers[i].Annex = thisuser.Annex;
                            cz = false;
                            break;
                        }
                    }
                    if (cz) {
                        //Input 页面需要 去操作List页面的数组 parent
                        parent.$ExaminationRecord.EquipmenFacilities.push({
                            id: thisuser.id,
                            IsPassed: thisuser.IsPassed,
                            TrainingCoursewareName: thisuser.TrainingCoursewareName,
                            ExaminationDate: thisuser.ExaminationDate,
                            DegreeOfDifficulty: thisuser.DegreeOfDifficulty,
                            Examiner: thisuser.Examiner,
                            ContractorName: thisuser.ContractorName,
                            editor: Mock.Random.cname(),
                            editorTime: Mock.mock('@datetime()'),
                            Remarks: thisuser.Remarks,
                            ExaminationCategory: thisuser.ExaminationCategory,
                            Fraction: thisuser.Fraction,
                            Annex: thisuser.Annex,
                        });
                    }
                    return {
                        result: "Success",
                        message: null,
                        data: null
                    };
                });
                break;
        }
    },
    EquipmenFacilities: [],
    InitArray: function () {
        for (var i = 0; i < 80; i++) {
            $ExaminationRecord.EquipmenFacilities.push(Mock.mock({
                id: Mock.Random.id(),
                IsPassed: randomValue("57"), //是否合格
                TrainingCoursewareName: randomValue("54"), // ,//培训课件名称
                ExaminationDate: Mock.mock('@date()'), //考试日期
                DegreeOfDifficulty: randomValue("55"), //难易程度
                Examiner: Mock.Random.cname(),
                ContractorName: randomValue("139"), //承包商名称
                editor: Mock.Random.cname(),
                PersonApproving: Mock.Random.cname(),
                editorTime: Mock.mock('@date()'),
                // Remarks: Mock.mock('@cparagraph(1, 1)'), //备注
                Remarks: '', //备注
                ExaminationCategory: randomValue("56"),
                Fraction: i + 1,
                Annex: Mock.mock('@cparagraph(1, 1)') + '.jsp',

            }));
        }
    }
}

//承包商违规台账
var $ContractorViolation = {
    DealUrl: function (vueApp, url, type, param) {
        var my = vueApp;
        switch (url) {
            ////删除
            case '/api/ContractorViolation/DeleteMuti':
                Mock.mock(host + url, type, function (options) {
                    var delIDs = options.body;
                    var temp = [];
                    for (var i = 0; i < $ContractorViolation.EquipmenFacilities.length; i++) {
                        temp.push($ContractorViolation.EquipmenFacilities[i]);
                    }
                    for (var i = 0; i < temp.length; i++) {
                        if (delIDs.includes(temp[i].id)) {
                            $ContractorViolation.EquipmenFacilities.splice(temp[i], 1);
                        }
                    }
                    return {
                        result: "Success",
                        message: null,
                        data: null
                    };
                });
                break;
                //获取List数据
            case '/api/ContractorViolation/GetList':
                Mock.mock(host + url, type,
                    function (options) {
                        if ($ContractorViolation.EquipmenFacilities.length == 0) {
                            $ContractorViolation.InitArray();
                        }
                        var p = JSON.parse(options.body);
                        //条件
                        var ContractorName = p.model.ContractorName;
                        var Violators = p.model.Violators;
                        var IsBlacklist = getDicValue("50", p.model.IsBlacklist);
                        //分页
                        var offset = p.offset;
                        var limit = p.limit;
                        var limitUsers2 = [];
                        for (var i = 0; i < $ContractorViolation.EquipmenFacilities.length; i++) {
                            var user = $ContractorViolation.EquipmenFacilities[i];
                            if (Violators && user.Violators.indexOf(Violators) == -1)
                                continue;
                            if (ContractorName && user.ContractorName.indexOf(ContractorName) == -1)
                                continue;
                            if (IsBlacklist && user.IsBlacklist.indexOf(IsBlacklist) == -1)
                                continue;

                            user.IsBlacklist = getDicValue("50", user.IsBlacklist) == '' ? user.IsBlacklist : getDicValue("50", user.IsBlacklist);
                            limitUsers2.push(user);
                        }

                        var limitUsers = [];
                        for (var i = 0; i < limitUsers2.length; i++) {
                            if (i < offset + limit && i >= offset) {
                                limitUsers.push(limitUsers2[i]);
                            }
                        }
                        return {
                            result: "Success",
                            message: null,
                            data: {
                                pageData: limitUsers,
                                rowCount: limitUsers2.length
                            }
                        };
                    });
                break;
                ////获取Input数据
            case '/api/ContractorViolation/get':
                Mock.mock(host + url + '?' + param, type, function (options) {

                    var myUsers = parent.$ContractorViolation.EquipmenFacilities;
                    myuser = {};
                    for (var i = 0; i < myUsers.length; i++) {
                        if (myUsers[i].id == vueApp.id) {
                            myuser = myUsers[i];
                            break;
                        }
                    }
                    myuser.IsBlacklist = getDicKey("50", myuser.IsBlacklist);
                    return {
                        result: "Success",
                        message: null,
                        data: myuser
                    };
                });
                break;
                ////提交
            case '/api/ContractorViolation/Save':
                Mock.mock(host + url, type, function (options) {
                    var thisuser = JSON.parse(options.body);
                    var thisUsers = parent.$ContractorViolation.EquipmenFacilities;
                    var cz = true;
                    for (var i = 0; i < thisUsers.length; i++) {
                        if (thisUsers[i].id == thisuser.id) {
                            thisUsers[i].DiscoveringPeople = thisuser.DiscoveringPeople;
                            thisUsers[i].ViolationClause = thisuser.ViolationClause;
                            thisUsers[i].Violators = thisuser.Violators;
                            thisUsers[i].ViolationInstructions = thisuser.ViolationInstructions;
                            thisUsers[i].ViolationDate = thisuser.ViolationDate;
                            thisUsers[i].ContractorName = thisuser.ContractorName;
                            thisUsers[i].Remarks = thisuser.Remarks;
                            thisUsers[i].ProcessingOpinion = thisuser.ProcessingOpinion;
                            thisUsers[i].IsBlacklist = thisuser.IsBlacklist;
                            thisUsers[i].ExamineState = thisuser.ExamineState;
                            cz = false;
                            break;
                        }
                    }
                    if (cz) {
                        //Input 页面需要 去操作List页面的数组 parent
                        parent.$ContractorViolation.EquipmenFacilities.push({
                            id: thisuser.id,
                            DiscoveringPeople: thisuser.DiscoveringPeople,
                            ViolationClause: thisuser.ViolationClause,
                            Violators: thisuser.Violators,
                            ViolationInstructions: thisuser.ViolationInstructions,
                            ViolationDate: thisuser.ViolationDate,
                            ContractorName: thisuser.ContractorName,
                            Remarks: thisuser.Remarks,
                            ProcessingOpinion: thisuser.ProcessingOpinion,
                            IsBlacklist: thisuser.IsBlacklist,
                            ExamineState: thisuser.ExamineState,
                        });
                    }
                    return {
                        result: "Success",
                        message: null,
                        data: null
                    };
                });
                break;

            case '/api/ContractorViolation/Agreed':
                Mock.mock(host + url, type, function (options) {
                    var thisuser = JSON.parse(options.body);
                    var thisUsers = parent.$ContractorViolation.EquipmenFacilities;
                    var cz = true;
                    for (var i = 0; i < thisUsers.length; i++) {
                        if (thisUsers[i].id == thisuser.id) {
                            thisUsers[i].DiscoveringPeople = thisuser.DiscoveringPeople;
                            thisUsers[i].ViolationClause = thisuser.ViolationClause;
                            thisUsers[i].Violators = thisuser.Violators;
                            thisUsers[i].ViolationInstructions = thisuser.ViolationInstructions;
                            thisUsers[i].ViolationDate = thisuser.ViolationDate;
                            thisUsers[i].ContractorName = thisuser.ContractorName;
                            thisUsers[i].Remarks = thisuser.Remarks;
                            thisUsers[i].ProcessingOpinion = thisuser.ProcessingOpinion;
                            thisUsers[i].IsBlacklist = thisuser.IsBlacklist;
                            thisUsers[i].ExamineState = "同意";
                            cz = false;
                            break;
                        }
                    }
                    if (cz) {
                        //Input 页面需要 去操作List页面的数组 parent
                        parent.$ContractorViolation.EquipmenFacilities.push({
                            id: thisuser.id,
                            DiscoveringPeople: thisuser.DiscoveringPeople,
                            ViolationClause: thisuser.ViolationClause,
                            Violators: thisuser.Violators,
                            ViolationInstructions: thisuser.ViolationInstructions,
                            ViolationDate: thisuser.ViolationDate,
                            ContractorName: thisuser.ContractorName,
                            Remarks: thisuser.Remarks,
                            ProcessingOpinion: thisuser.ProcessingOpinion,
                            IsBlacklist: thisuser.IsBlacklist,
                            ExamineState: thisuser.ExamineState,
                        });
                    }
                    return {
                        result: "Success",
                        message: null,
                        data: null
                    };
                });
                break;

            case '/api/ContractorViolation/NoAgreed':
                Mock.mock(host + url, type, function (options) {
                    var thisuser = JSON.parse(options.body);
                    var thisUsers = parent.$ContractorViolation.EquipmenFacilities;
                    var cz = true;
                    for (var i = 0; i < thisUsers.length; i++) {
                        if (thisUsers[i].id == thisuser.id) {
                            thisUsers[i].DiscoveringPeople = thisuser.DiscoveringPeople;
                            thisUsers[i].ViolationClause = thisuser.ViolationClause;
                            thisUsers[i].Violators = thisuser.Violators;
                            thisUsers[i].ViolationInstructions = thisuser.ViolationInstructions;
                            thisUsers[i].ViolationDate = thisuser.ViolationDate;
                            thisUsers[i].ContractorName = thisuser.ContractorName;
                            thisUsers[i].Remarks = thisuser.Remarks;
                            thisUsers[i].ProcessingOpinion = thisuser.ProcessingOpinion;
                            thisUsers[i].IsBlacklist = thisuser.IsBlacklist;
                            thisUsers[i].ExamineState = "不同意";
                            cz = false;
                            break;
                        }
                    }
                    if (cz) {
                        //Input 页面需要 去操作List页面的数组 parent
                        parent.$ContractorViolation.EquipmenFacilities.push({
                            id: thisuser.id,
                            DiscoveringPeople: thisuser.DiscoveringPeople,
                            ViolationClause: thisuser.ViolationClause,
                            Violators: thisuser.Violators,
                            ViolationInstructions: thisuser.ViolationInstructions,
                            ViolationDate: thisuser.ViolationDate,
                            ContractorName: thisuser.ContractorName,
                            Remarks: thisuser.Remarks,
                            ProcessingOpinion: thisuser.ProcessingOpinion,
                            IsBlacklist: thisuser.IsBlacklist,
                            ExamineState: thisuser.ExamineState,
                        });
                    }
                    return {
                        result: "Success",
                        message: null,
                        data: null
                    };
                });
                break;
        }
    },
    EquipmenFacilities: [],
    InitArray: function () {
        for (var i = 0; i < 80; i++) {
            $ContractorViolation.EquipmenFacilities.push(Mock.mock({
                id: Mock.Random.id(),
                DiscoveringPeople: Mock.Random.cname(), //发现人
                ViolationClause: randomValue("chy3"), //违规条款
                FoundArea: randomValue("n69"),
                Violators: Mock.Random.cname(), //违规人
                editor: Mock.Random.cname(), //违规人
                ViolationInstructions: randomValue("chy3"), //违规情况说明
                ViolationDate: Mock.mock('@date()'), //违规日期
                editorTime: Mock.mock('@date()'), //违规日期
                ContractorName: randomValue("139"), //承包商名称
                Remarks: Mock.mock('@cparagraph(1, 1)'), //备注
                ProcessingOpinion: Mock.mock('@cparagraph(1, 1)'), //处理意见
                IsBlacklist: randomValue("50"), //是否列入黑名单
                ExamineState: randomValue("58"), //审核结果
            }));
        }
    }
}


//承包商违章次数统计
var $ViolationNumber = {
    DealUrl: function (vueApp, url, type, param) {
        var my = vueApp;
        switch (url) {
            ////删除
            case '/api/ViolationNumber/DeleteMuti':
                Mock.mock(host + url, type, function (options) {
                    var delIDs = options.body;
                    var temp = [];
                    for (var i = 0; i < $ViolationNumber.EquipmenFacilities.length; i++) {
                        temp.push($ViolationNumber.EquipmenFacilities[i]);
                    }
                    for (var i = 0; i < temp.length; i++) {
                        if (delIDs.includes(temp[i].id)) {
                            $ViolationNumber.EquipmenFacilities.splice(temp[i], 1);
                        }
                    }
                    return {
                        result: "Success",
                        message: null,
                        data: null
                    };
                });
                break;
                //获取List数据
            case '/api/ViolationNumber/GetList':
                Mock.mock(host + url, type,
                    function (options) {
                        if ($ViolationNumber.EquipmenFacilities.length == 0) {
                            $ViolationNumber.InitArray();
                        }
                        var p = JSON.parse(options.body);
                        //条件
                        var ContractorName = p.model.ContractorName;
                        var Violators = p.model.Violators;
                        var IsBlacklist = getDicValue("50", p.model.IsBlacklist);
                        //分页
                        var offset = p.offset;
                        var limit = p.limit;
                        var limitUsers2 = [];
                        for (var i = 0; i < $ViolationNumber.EquipmenFacilities.length; i++) {
                            var user = $ViolationNumber.EquipmenFacilities[i];
                            if (Violators && user.Violators.indexOf(Violators) == -1)
                                continue;
                            if (ContractorName && user.ContractorName.indexOf(ContractorName) == -1)
                                continue;
                            if (IsBlacklist && user.IsBlacklist.indexOf(IsBlacklist) == -1)
                                continue;

                            user.IsBlacklist = getDicValue("50", user.IsBlacklist) == '' ? user.IsBlacklist : getDicValue("50", user.IsBlacklist);
                            limitUsers2.push(user);
                        }

                        var limitUsers = [];
                        for (var i = 0; i < limitUsers2.length; i++) {
                            if (i < offset + limit && i >= offset) {
                                limitUsers.push(limitUsers2[i]);
                            }
                        }
                        return {
                            result: "Success",
                            message: null,
                            data: {
                                pageData: limitUsers,
                                rowCount: limitUsers2.length
                            }
                        };
                    });
                break;
                ////获取Input数据
            case '/api/ViolationNumber/get':
                Mock.mock(host + url + '?' + param, type, function (options) {

                    var myUsers = parent.$ViolationNumber.EquipmenFacilities;
                    myuser = {};
                    for (var i = 0; i < myUsers.length; i++) {
                        if (myUsers[i].id == vueApp.id) {
                            myuser = myUsers[i];
                            break;
                        }
                    }
                    myuser.IsBlacklist = getDicKey("50", myuser.IsBlacklist);
                    return {
                        result: "Success",
                        message: null,
                        data: myuser
                    };
                });
                break;
                ////提交
            case '/api/ViolationNumber/Save':
                Mock.mock(host + url, type, function (options) {
                    var thisuser = JSON.parse(options.body);
                    var thisUsers = parent.$ViolationNumber.EquipmenFacilities;
                    var cz = true;
                    for (var i = 0; i < thisUsers.length; i++) {
                        if (thisUsers[i].id == thisuser.id) {
                            thisUsers[i].ViolationDate = thisuser.ViolationDate;
                            thisUsers[i].ContractorName = thisuser.ContractorName;
                            cz = false;
                            break;
                        }
                    }
                    if (cz) {
                        //Input 页面需要 去操作List页面的数组 parent
                        parent.$ViolationNumber.EquipmenFacilities.push({
                            id: thisuser.id,
                            ViolationDate: thisuser.ViolationDate,
                            ContractorName: thisuser.ContractorName,
                        });
                    }
                    return {
                        result: "Success",
                        message: null,
                        data: null
                    };
                });
                break;

            case '/api/ViolationNumber/Agreed':
                Mock.mock(host + url, type, function (options) {
                    var thisuser = JSON.parse(options.body);
                    var thisUsers = parent.$ViolationNumber.EquipmenFacilities;
                    var cz = true;
                    for (var i = 0; i < thisUsers.length; i++) {
                        if (thisUsers[i].id == thisuser.id) {
                            thisUsers[i].ViolationDate = thisuser.ViolationDate;
                            thisUsers[i].ContractorName = thisuser.ContractorName;
                            cz = false;
                            break;
                        }
                    }
                    if (cz) {
                        //Input 页面需要 去操作List页面的数组 parent
                        parent.$ViolationNumber.EquipmenFacilities.push({
                            id: thisuser.id,
                            ViolationDate: thisuser.ViolationDate,
                            ContractorName: thisuser.ContractorName,
                        });
                    }
                    return {
                        result: "Success",
                        message: null,
                        data: null
                    };
                });
                break;

            case '/api/ViolationNumber/NoAgreed':
                Mock.mock(host + url, type, function (options) {
                    var thisuser = JSON.parse(options.body);
                    var thisUsers = parent.$ViolationNumber.EquipmenFacilities;
                    var cz = true;
                    for (var i = 0; i < thisUsers.length; i++) {
                        if (thisUsers[i].id == thisuser.id) {
                            thisUsers[i].ViolationDate = thisuser.ViolationDate;
                            thisUsers[i].ContractorName = thisuser.ContractorName;
                            cz = false;
                            break;
                        }
                    }
                    if (cz) {
                        //Input 页面需要 去操作List页面的数组 parent
                        parent.$ViolationNumber.EquipmenFacilities.push({
                            id: thisuser.id,
                            ViolationDate: thisuser.ViolationDate,
                            ContractorName: thisuser.ContractorName,

                        });
                    }
                    return {
                        result: "Success",
                        message: null,
                        data: null
                    };
                });
                break;
        }
    },
    EquipmenFacilities: [],
    InitArray: function () {
        for (var i = 0; i < 15; i++) {
            $ViolationNumber.EquipmenFacilities.push(Mock.mock({
                id: Mock.Random.id(),
                ViolationDate: Mock.mock('@date()'), //违规时间
                ContractorName: randomValue("139"), //承包商名称
                ViolationNumber: Mock.mock({
                    "number|1-10": 10
                }).number, //违章次数

            }));
        }
    }
}


//承包商安全工时统计
var $SafetyWorkingHours = {
    DealUrl: function (vueApp, url, type, param) {
        var my = vueApp;
        switch (url) {
            ////删除
            case '/api/SafetyWorkingHours/DeleteMuti':
                Mock.mock(host + url, type, function (options) {
                    var delIDs = options.body;
                    var temp = [];
                    for (var i = 0; i < $SafetyWorkingHours.EquipmenFacilities.length; i++) {
                        temp.push($SafetyWorkingHours.EquipmenFacilities[i]);
                    }
                    for (var i = 0; i < temp.length; i++) {
                        if (delIDs.includes(temp[i].id)) {
                            $SafetyWorkingHours.EquipmenFacilities.splice(temp[i], 1);
                        }
                    }
                    return {
                        result: "Success",
                        message: null,
                        data: null
                    };
                });
                break;
                //获取List数据
            case '/api/SafetyWorkingHours/GetList':
                Mock.mock(host + url, type,
                    function (options) {
                        if ($SafetyWorkingHours.EquipmenFacilities.length == 0) {
                            $SafetyWorkingHours.InitArray();
                        }
                        var p = JSON.parse(options.body);
                        //条件
                        var ContractorName = p.model.ContractorName;
                        var Violators = p.model.Violators;
                        var IsBlacklist = getDicValue("50", p.model.IsBlacklist);
                        //分页
                        var offset = p.offset;
                        var limit = p.limit;
                        var limitUsers2 = [];
                        for (var i = 0; i < $SafetyWorkingHours.EquipmenFacilities.length; i++) {
                            var user = $SafetyWorkingHours.EquipmenFacilities[i];
                            if (Violators && user.Violators.indexOf(Violators) == -1)
                                continue;
                            if (ContractorName && user.ContractorName.indexOf(ContractorName) == -1)
                                continue;
                            if (IsBlacklist && user.IsBlacklist.indexOf(IsBlacklist) == -1)
                                continue;

                            user.IsBlacklist = getDicValue("50", user.IsBlacklist) == '' ? user.IsBlacklist : getDicValue("50", user.IsBlacklist);
                            limitUsers2.push(user);
                        }

                        var limitUsers = [];
                        for (var i = 0; i < limitUsers2.length; i++) {
                            if (i < offset + limit && i >= offset) {
                                limitUsers.push(limitUsers2[i]);
                            }
                        }
                        return {
                            result: "Success",
                            message: null,
                            data: {
                                pageData: limitUsers,
                                rowCount: limitUsers2.length
                            }
                        };
                    });
                break;
                ////获取Input数据
            case '/api/SafetyWorkingHours/get':
                Mock.mock(host + url + '?' + param, type, function (options) {

                    var myUsers = parent.$SafetyWorkingHours.EquipmenFacilities;
                    myuser = {};
                    for (var i = 0; i < myUsers.length; i++) {
                        if (myUsers[i].id == vueApp.id) {
                            myuser = myUsers[i];
                            break;
                        }
                    }
                    myuser.IsBlacklist = getDicKey("50", myuser.IsBlacklist);
                    return {
                        result: "Success",
                        message: null,
                        data: myuser
                    };
                });
                break;
                ////提交
            case '/api/ViolatiSafetyWorkingHoursonNumber/Save':
                Mock.mock(host + url, type, function (options) {
                    var thisuser = JSON.parse(options.body);
                    var thisUsers = parent.$SafetyWorkingHours.EquipmenFacilities;
                    var cz = true;
                    for (var i = 0; i < thisUsers.length; i++) {
                        if (thisUsers[i].id == thisuser.id) {
                            thisUsers[i].ViolationDate = thisuser.ViolationDate;
                            thisUsers[i].ContractorName = thisuser.ContractorName;
                            cz = false;
                            break;
                        }
                    }
                    if (cz) {
                        //Input 页面需要 去操作List页面的数组 parent
                        parent.$SafetyWorkingHours.EquipmenFacilities.push({
                            id: thisuser.id,
                            ViolationDate: thisuser.ViolationDate,
                            ContractorName: thisuser.ContractorName,
                        });
                    }
                    return {
                        result: "Success",
                        message: null,
                        data: null
                    };
                });
                break;

            case '/api/SafetyWorkingHours/Agreed':
                Mock.mock(host + url, type, function (options) {
                    var thisuser = JSON.parse(options.body);
                    var thisUsers = parent.$SafetyWorkingHours.EquipmenFacilities;
                    var cz = true;
                    for (var i = 0; i < thisUsers.length; i++) {
                        if (thisUsers[i].id == thisuser.id) {
                            thisUsers[i].ViolationDate = thisuser.ViolationDate;
                            thisUsers[i].ContractorName = thisuser.ContractorName;
                            cz = false;
                            break;
                        }
                    }
                    if (cz) {
                        //Input 页面需要 去操作List页面的数组 parent
                        parent.$SafetyWorkingHours.EquipmenFacilities.push({
                            id: thisuser.id,
                            ViolationDate: thisuser.ViolationDate,
                            ContractorName: thisuser.ContractorName,
                        });
                    }
                    return {
                        result: "Success",
                        message: null,
                        data: null
                    };
                });
                break;

            case '/api/SafetyWorkingHours/NoAgreed':
                Mock.mock(host + url, type, function (options) {
                    var thisuser = JSON.parse(options.body);
                    var thisUsers = parent.$SafetyWorkingHours.EquipmenFacilities;
                    var cz = true;
                    for (var i = 0; i < thisUsers.length; i++) {
                        if (thisUsers[i].id == thisuser.id) {
                            thisUsers[i].ViolationDate = thisuser.ViolationDate;
                            thisUsers[i].ContractorName = thisuser.ContractorName;
                            cz = false;
                            break;
                        }
                    }
                    if (cz) {
                        //Input 页面需要 去操作List页面的数组 parent
                        parent.$SafetyWorkingHours.EquipmenFacilities.push({
                            id: thisuser.id,
                            ViolationDate: thisuser.ViolationDate,
                            ContractorName: thisuser.ContractorName,

                        });
                    }
                    return {
                        result: "Success",
                        message: null,
                        data: null
                    };
                });
                break;
        }
    },
    EquipmenFacilities: [],
    InitArray: function () {
        for (var i = 0; i < 15; i++) {
            $SafetyWorkingHours.EquipmenFacilities.push(Mock.mock({
                id: Mock.Random.id(),
                ContractorName: randomValue("139"), //承包商名称
                Name: Mock.mock('@cname()'), //违规时间
                StartTime: Mock.Random.date(), //违规时间
                Time: Mock.mock({
                    "number|6-12": 12
                }).number + "小时" //违规时间
            }));
        }
    }
}

//日常评估类型管理
var $DailyAssessmentType = {
    DealUrl: function (vueApp, url, type, param) {
        var my = vueApp;
        switch (url) {
            ////删除
            case '/api/DailyAssessmentType/DeleteMuti':
                Mock.mock(host + url, type, function (options) {
                    var delIDs = options.body;
                    var temp = [];
                    for (var i = 0; i < $DailyAssessmentType.EquipmenFacilities.length; i++) {
                        temp.push($DailyAssessmentType.EquipmenFacilities[i]);
                    }
                    for (var i = 0; i < temp.length; i++) {
                        if (delIDs.includes(temp[i].id)) {
                            $DailyAssessmentType.EquipmenFacilities.splice(temp[i], 1);
                        }
                    }
                    return {
                        result: "Success",
                        message: null,
                        data: null
                    };
                });
                break;
                //获取List数据
            case '/api/DailyAssessmentType/GetList':
                Mock.mock(host + url, type,
                    function (options) {
                        if ($DailyAssessmentType.EquipmenFacilities.length == 0) {
                            $DailyAssessmentType.InitArray();
                        }

                        var p = JSON.parse(options.body);
                        //条件
                        var DailyAssessmentTypeName = p.model.DailyAssessmentTypeName;
                        var Type = p.model.Type;
                        //分页
                        var offset = p.offset;
                        var limit = p.limit;
                        var limitUsers2 = [];
                        for (var i = 0; i < $DailyAssessmentType.EquipmenFacilities.length; i++) {
                            var user = $DailyAssessmentType.EquipmenFacilities[i];
                            if (DailyAssessmentTypeName && user.DailyAssessmentTypeName.indexOf(DailyAssessmentTypeName) == -1)
                                continue;
                            if (Type && user.Type.indexOf(Type) == -1)
                                continue;
                            limitUsers2.push(user);
                        }
                        var limitUsers = [];
                        for (var i = 0; i < limitUsers2.length; i++) {
                            if (i < offset + limit && i >= offset) {
                                limitUsers.push(limitUsers2[i]);
                            }
                        }
                        return {
                            result: "Success",
                            message: null,
                            data: {
                                pageData: limitUsers,
                                rowCount: limitUsers2.length
                            }
                        };
                    });
                break;
                ////获取Input数据
            case '/api/DailyAssessmentType/get':
                Mock.mock(host + url + '?' + param, type, function (options) {

                    var myUsers = $DailyAssessmentType.EquipmenFacilities;
                    myuser = {};
                    for (var i = 0; i < myUsers.length; i++) {
                        if (myUsers[i].id == vueApp.id) {
                            myuser = myUsers[i];
                            break;
                        }
                    }
                    return {
                        result: "Success",
                        message: null,
                        data: myuser
                    };
                });
                break;
                ////提交
            case '/api/DailyAssessmentType/Save':
                Mock.mock(host + url, type, function (options) {
                    var thisuser = JSON.parse(options.body);
                    var thisUsers = $DailyAssessmentType.EquipmenFacilities;
                    var cz = true;
                    for (var i = 0; i < thisUsers.length; i++) {
                        if (thisUsers[i].id == thisuser.id) {
                            thisUsers[i].DailyAssessmentTypeName = thisuser.DailyAssessmentTypeName;
                            thisUsers[i].CheckProjectList = thisuser.CheckProjectList;
                            thisUsers[i].CheckProject = thisuser.CheckProject;
                            thisUsers[i].Points = thisuser.Points;
                            thisUsers[i].Type = thisuser.Type;
                            thisUsers[i].editor = Mock.Random.cname(),
                                thisUsers[i].editorTime = Mock.Random.datetime(), //编辑时间
                                cz = false;
                            break;
                        }
                    }
                    if (cz) {
                        //Input 页面需要 去操作List页面的数组 parent
                        $DailyAssessmentType.EquipmenFacilities.unshift({
                            id: thisuser.id,
                            DailyAssessmentTypeName: thisuser.DailyAssessmentTypeName,
                            CheckProjectList: thisuser.CheckProjectList,
                            CheckProject: thisuser.CheckProject,
                            Points: thisuser.Points,
                            Type: thisuser.Type,
                            editor: Mock.Random.cname(),
                            editorTime: Mock.Random.datetime(), //编辑时间
                        });
                    }
                    return {
                        result: "Success",
                        message: null,
                        data: null
                    };
                });
                break;
        }
    },
    EquipmenFacilities: [],
    InitArray: function () {
        for (var i = 0; i < 60; i++) {
            $DailyAssessmentType.EquipmenFacilities.push(Mock.mock({
                id: Mock.Random.id(),
                DailyAssessmentTypeName: randomValue("56"), //姓名
                CheckProject: randomValue("56"), //检查项目
                Type: randomValue("29"), //类型
                Points: Mock.mock({
                    "number|50-100": 100
                }).number, //权重分
                CheckProjectList: DailyAssessmentCheckProject(),
                editor: Mock.Random.cname(), //编辑人
                editorTime: Mock.Random.datetime(), //编辑时间
            }));
        }
    }
}

function DailyAssessmentCheckProject() {
    var CheckProjectList = [];

    for (var i = 0; i < 5; i++) {
        var Number = random(0, 4);
        var CheckProject = {};
        CheckProject.CheckProject = getDicValue("107", Number);
        CheckProject.NotUpToStandard = 0;
        CheckProject.SmallUpToStandard = 2;
        CheckProject.MostUpToStandard = 4;
        CheckProject.UpToStandard = 6;
        CheckProject.GoodStandard = 8;
        CheckProject.VeryGoodStandard = 10;
        CheckProjectList.push(CheckProject);

    }
    return CheckProjectList;
}

//总体评估类型管理
var $OverallAssessmentType = {
    DealUrl: function (vueApp, url, type, param) {
        var my = vueApp;
        switch (url) {
            ////删除
            case '/api/OverallAssessmentType/DeleteMuti':
                Mock.mock(host + url, type, function (options) {
                    var delIDs = options.body;
                    var temp = [];
                    for (var i = 0; i < $OverallAssessmentType.EquipmenFacilities.length; i++) {
                        temp.push($OverallAssessmentType.EquipmenFacilities[i]);
                    }
                    for (var i = 0; i < temp.length; i++) {
                        if (delIDs.includes(temp[i].id)) {
                            $OverallAssessmentType.EquipmenFacilities.splice(temp[i], 1);
                        }
                    }
                    return {
                        result: "Success",
                        message: null,
                        data: null
                    };
                });
                break;
                //获取List数据
            case '/api/OverallAssessmentType/GetList':
                Mock.mock(host + url, type,
                    function (options) {
                        if ($OverallAssessmentType.EquipmenFacilities.length == 0) {
                            $OverallAssessmentType.InitArray();
                        }
                        var p = JSON.parse(options.body);
                        //条件
                        var OverallEvaluationTypeName = p.model.OverallEvaluationTypeName;
                        var Type = p.model.Type;
                        //分页
                        var offset = p.offset;
                        var limit = p.limit;
                        var limitUsers2 = [];
                        for (var i = 0; i < $OverallAssessmentType.EquipmenFacilities.length; i++) {
                            var user = $OverallAssessmentType.EquipmenFacilities[i];
                            if (OverallEvaluationTypeName && user.OverallEvaluationTypeName.indexOf(OverallEvaluationTypeName) == -1)
                                continue;
                            if (Type && user.Type.indexOf(Type) == -1)
                                continue;
                            limitUsers2.push(user);
                        }
                        var limitUsers = [];
                        for (var i = 0; i < limitUsers2.length; i++) {
                            if (i < offset + limit && i >= offset) {
                                limitUsers.push(limitUsers2[i]);
                            }
                        }
                        return {
                            result: "Success",
                            message: null,
                            data: {
                                pageData: limitUsers,
                                rowCount: limitUsers2.length
                            }
                        };
                    });
                break;
                ////获取Input数据
            case '/api/OverallAssessmentType/get':
                Mock.mock(host + url + '?' + param, type, function (options) {

                    var myUsers = $OverallAssessmentType.EquipmenFacilities;
                    myuser = {};
                    for (var i = 0; i < myUsers.length; i++) {
                        if (myUsers[i].id == vueApp.id) {
                            myuser = myUsers[i];
                            break;
                        }
                    }
                    return {
                        result: "Success",
                        message: null,
                        data: myuser
                    };
                });
                break;
                ////提交
            case '/api/OverallAssessmentType/Save':
                Mock.mock(host + url, type, function (options) {
                    var thisuser = JSON.parse(options.body);
                    var thisUsers = $OverallAssessmentType.EquipmenFacilities;
                    var cz = true;
                    for (var i = 0; i < thisUsers.length; i++) {
                        if (thisUsers[i].id == thisuser.id) {
                            thisUsers[i].OverallAssessmentTypeName = thisuser.OverallAssessmentTypeName;
                            thisUsers[i].CheckProjectList = thisuser.CheckProjectList;
                            thisUsers[i].CheckProject = thisuser.CheckProject;
                            thisUsers[i].Points = thisuser.Points;
                            thisUsers[i].Type = thisuser.Type;
                            thisUsers[i].editor = Mock.Random.cname(),
                                thisUsers[i].editorTime = Mock.Random.datetime(), //编辑时间
                                cz = false;
                            break;
                        }
                    }
                    if (cz) {
                        //Input 页面需要 去操作List页面的数组 parent
                        $OverallAssessmentType.EquipmenFacilities.unshift({
                            id: thisuser.id,
                            OverallAssessmentTypeName: thisuser.OverallAssessmentTypeName,
                            CheckProjectList: thisuser.CheckProjectList,
                            CheckProject: thisuser.CheckProject,
                            Points: thisuser.Points,
                            Type: thisuser.Type,
                            editor: Mock.Random.cname(),
                            editorTime: Mock.Random.datetime(), //编辑时间
                        });
                    }
                    return {
                        result: "Success",
                        message: null,
                        data: null
                    };
                });
                break;
        }
    },
    EquipmenFacilities: [],
    InitArray: function () {
        for (var i = 0; i < 60; i++) {
            $OverallAssessmentType.EquipmenFacilities.push(Mock.mock({
                id: Mock.Random.id(),
                OverallAssessmentTypeName: randomValue("56"), //姓名
                CheckProject: randomValue("56"), //检查项目
                Type: randomValue("29"), //类型
                Points: Mock.mock({
                    "number|50-100": 100
                }).number, //权重分
                CheckProjectList: OverallAssessmentCheckProject(),
                editor: Mock.Random.cname(), //编辑人
                editorTime: Mock.Random.datetime(), //编辑时间
            }));
        }
    }
}

function OverallAssessmentCheckProject() {
    var CheckProjectList = [];
    for (var i = 0; i < 5; i++) {
        var Number = random(0, 4);
        var NumberA = random(10, 30);
        var CheckProject = {};
        CheckProject.CheckProject = getDicValue("107", Number);
        CheckProject.TheWeight = NumberA;
        CheckProjectList.push(CheckProject);
    }
    return CheckProjectList;
}

//日常评估考核
var $DailyAssessment = {
    DealUrl: function (vueApp, url, type, param) {
        var my = vueApp;
        switch (url) {
            ////删除
            case '/api/DailyAssessment/DeleteMuti':
                Mock.mock(host + url, type, function (options) {
                    var delIDs = options.body;
                    var temp = [];
                    for (var i = 0; i < $DailyAssessment.EquipmenFacilities.length; i++) {
                        temp.push($DailyAssessment.EquipmenFacilities[i]);
                    }
                    for (var i = 0; i < temp.length; i++) {
                        if (delIDs.includes(temp[i].id)) {
                            $DailyAssessment.EquipmenFacilities.splice(temp[i], 1);
                        }
                    }
                    return {
                        result: "Success",
                        message: null,
                        data: null
                    };
                });
                break;
                //获取List数据
            case '/api/DailyAssessment/GetList':
                Mock.mock(host + url, type,
                    function (options) {
                        if ($DailyAssessment.EquipmenFacilities.length == 0) {
                            $DailyAssessment.InitArray();
                        }

                        var p = JSON.parse(options.body);
                        //条件
                        var ContractorName = p.model.ContractorName;
                        var Type = p.model.Type;
                        var DailyAssessmentTypeName = getDicValue("56", p.model.DailyAssessmentTypeName);
                        //分页
                        var offset = p.offset;
                        var limit = p.limit;
                        var limitUsers2 = [];
                        for (var i = 0; i < $DailyAssessment.EquipmenFacilities.length; i++) {
                            var user = $DailyAssessment.EquipmenFacilities[i];
                            if (DailyAssessmentTypeName && user.DailyAssessmentTypeName.indexOf(DailyAssessmentTypeName) == -1)
                                continue;
                            if (ContractorName && user.ContractorName.indexOf(ContractorName) == -1)
                                continue;
                            if (Type && user.Type.indexOf(Type) == -1)
                                continue;
                            user.TerritorialAppraiser = getDicValue("61", user.TerritorialAppraiser) == '' ? user.TerritorialAppraiser : getDicValue("61", user.TerritorialAppraiser);
                            user.DailyAssessmentTypeName = getDicValue("56", user.DailyAssessmentTypeName) == '' ? user.DailyAssessmentTypeName : getDicValue("56", user.DailyAssessmentTypeName);
                            user.IsContractorDirectory = getDicValue("50", user.IsContractorDirectory) == '' ? user.IsContractorDirectory : getDicValue("50", user.IsContractorDirectory);
                            limitUsers2.push(user);
                        }

                        var limitUsers = [];
                        for (var i = 0; i < limitUsers2.length; i++) {
                            if (i < offset + limit && i >= offset) {
                                limitUsers.push(limitUsers2[i]);
                            }
                        }
                        return {
                            result: "Success",
                            message: null,
                            data: {
                                pageData: limitUsers,
                                rowCount: limitUsers2.length
                            }
                        };
                    });
                break;
                ////获取Input数据
            case '/api/DailyAssessment/get':
                Mock.mock(host + url + '?' + param, type, function (options) {

                    var myUsers = parent.$DailyAssessment.EquipmenFacilities;
                    myuser = {};
                    for (var i = 0; i < myUsers.length; i++) {
                        if (myUsers[i].id == vueApp.id) {
                            myuser = myUsers[i];
                            break;
                        }
                    }
                    myuser.IsContractorDirectory = getDicKey("50", myuser.IsContractorDirectory);
                    return {
                        result: "Success",
                        message: null,
                        data: myuser
                    };
                });
                break;
                ////提交
            case '/api/DailyAssessment/Save':
                Mock.mock(host + url, type, function (options) {
                    var thisuser = JSON.parse(options.body);
                    var thisUsers = parent.$DailyAssessment.EquipmenFacilities;
                    var cz = true;
                    for (var i = 0; i < thisUsers.length; i++) {
                        if (thisUsers[i].id == thisuser.id) {
                            thisUsers[i].DailyAssessmentTypeName = thisuser.DailyAssessmentTypeName;
                            thisUsers[i].ContractorName = thisuser.ContractorName;
                            thisUsers[i].ProjectName = thisuser.ProjectName;
                            thisUsers[i].Fraction = thisuser.Fraction;
                            thisUsers[i].Type = thisuser.Type;
                            thisUsers[i].TerritorialAppraiser = thisuser.TerritorialAppraiser;
                            thisUsers[i].TerritorialEvaluationConclusion = thisuser.TerritorialEvaluationConclusion;
                            thisUsers[i].TerritorialEvaluationDate = thisuser.TerritorialEvaluationDate;
                            thisUsers[i].BusinessManagementEvaluator = thisuser.BusinessManagementEvaluator;
                            thisUsers[i].BusinessManagementEvaluationConclusion = thisuser.BusinessManagementEvaluationConclusion;
                            thisUsers[i].BusinessManagementEvaluationData = thisuser.BusinessManagementEvaluationData;
                            thisUsers[i].IsContractorDirectory = thisuser.IsContractorDirectory;
                            thisUsers[i].SummaryEvaluator = thisuser.SummaryEvaluator;
                            thisUsers[i].SummaryEvaluationDate = thisuser.SummaryEvaluationDate;
                            thisUsers[i].CheckProjectList = thisuser.CheckProjectList;
                            thisUsers[i].ConclusionTime = thisuser.ConclusionTime;
                            thisUsers[i].participant = thisuser.participant;

                            cz = false;
                            break;
                        }
                    }
                    if (cz) {
                        //Input 页面需要 去操作List页面的数组 parent
                        parent.$DailyAssessment.EquipmenFacilities.push({

                            id: thisuser.id,
                            DailyAssessmentTypeName: thisuser.DailyAssessmentTypeName,
                            ContractorName: thisuser.ContractorName,
                            ProjectName: thisuser.ProjectName,
                            Fraction: thisuser.Fraction,
                            Type: thisuser.Type,
                            TerritorialAppraiser: thisuser.TerritorialAppraiser,
                            TerritorialEvaluationConclusion: thisuser.TerritorialEvaluationConclusion,
                            TerritorialEvaluationDate: thisuser.TerritorialEvaluationDate,
                            BusinessManagementEvaluator: thisuser.BusinessManagementEvaluator,
                            BusinessManagementEvaluationConclusion: thisuser.BusinessManagementEvaluationConclusion,
                            BusinessManagementEvaluationData: thisuser.BusinessManagementEvaluationData,
                            IsContractorDirectory: thisuser.IsContractorDirectory,
                            SummaryEvaluator: thisuser.SummaryEvaluator,
                            SummaryEvaluationDate: thisuser.SummaryEvaluationDate,
                            CheckProjectList: thisuser.CheckProjectList,
                            ConclusionTime: Mock.mock('@datetime()'),
                            participant: thisuser.participant,

                        });
                    }
                    return {
                        result: "Success",
                        message: null,
                        data: null
                    };
                });
                break;
        }
    },
    EquipmenFacilities: [],
    InitArray: function () {
        for (var i = 0; i < 80; i++) {
            var PersonInChargePidA = randomTreeNode(PersonInChargeTree, '0', true);
            var PersonInChargePidB = randomTreeNode(PersonInChargeTree, '0', true);
            var PersonInChargeIdA = randomTreeNode(PersonInChargeTree, PersonInChargePidA);
            var PersonInChargeIdB = randomTreeNode(PersonInChargeTree, PersonInChargePidB);
            $DailyAssessment.EquipmenFacilities.push(Mock.mock({
                id: Mock.Random.id(),
                DailyAssessmentTypeName: randomValue("56"), //日常评估考核类别名称
                ContractorName: randomValue("139"), //"承包商名称"
                Type: randomValue("29"), //"承包商类型"
                summary: randomValue("n55"), //"评价总结"
                ProjectName: Mock.mock('@cparagraph(1, 1)'), //"项目名称"
                Fraction: random(80, 100), // 分数
                TerritorialAppraiser: Mock.Random.cname(), //属地评价人
                editor: Mock.Random.cname(), //编辑人
                TerritorialEvaluationConclusion: Mock.mock('@cparagraph(1, 1)'), //属地评价结论
                TerritorialEvaluationDate: Mock.mock('@date()'), //属地评价日期
                BusinessManagementEvaluator: Mock.Random.cname(), //业务管理评价人
                BusinessManagementEvaluationConclusion: Mock.mock('@cparagraph(1, 1)'), //业务管理评价结论
                BusinessManagementEvaluationData: Mock.mock('@date()'), //业务管理评价日期
                IsContractorDirectory: randomValue("50"), //是否列入合格承包商名录
                SummaryEvaluator: Mock.Random.cname(), //总结评价人
                EditTime: Mock.mock('@date()'), //编辑时间
                assessTime: Mock.mock('@date()'), //评估日期
                SummaryEvaluationDate: Mock.mock('@date()'), //总结评价日期
                CheckProjectList: DailyAssessmentCheckedProject(),
                ConclusionTime: Mock.mock('@datetime()'),
                participant: [PersonInChargeIdA], //评估人

            }));
        }
    }
}

function DailyAssessmentCheckedProject() {
    var CheckProjectList = [];
    for (var i = 0; i < 5; i++) {
        var Number = random(0, 4);
        var CheckProject = {};
        CheckProject.CheckProject = getDicValue("107", Number);
        CheckProject.score = randomKey("60");
        CheckProjectList.push(CheckProject);
    }
    return CheckProjectList;
}

//总体评估考核
var $OverallAssessment = {
    DealUrl: function (vueApp, url, type, param) {
        var my = vueApp;
        switch (url) {
            ////删除
            case '/api/OverallAssessment/DeleteMuti':
                Mock.mock(host + url, type, function (options) {
                    var delIDs = options.body;
                    var temp = [];
                    for (var i = 0; i < $OverallAssessment.EquipmenFacilities.length; i++) {
                        temp.push($OverallAssessment.EquipmenFacilities[i]);
                    }
                    for (var i = 0; i < temp.length; i++) {
                        if (delIDs.includes(temp[i].id)) {
                            $OverallAssessment.EquipmenFacilities.splice(temp[i], 1);
                        }
                    }
                    return {
                        result: "Success",
                        message: null,
                        data: null
                    };
                });
                break;
                //获取List数据
            case '/api/OverallAssessment/GetList':
                Mock.mock(host + url, type,
                    function (options) {
                        if ($OverallAssessment.EquipmenFacilities.length == 0) {
                            $OverallAssessment.InitArray();
                        }

                        var p = JSON.parse(options.body);
                        //条件
                        var ContractorName = p.model.ContractorName;
                        var OverallAssessmentTypeName = getDicValue("56", p.model.OverallAssessmentTypeName);
                        //分页
                        var offset = p.offset;
                        var limit = p.limit;
                        var limitUsers2 = [];
                        for (var i = 0; i < $OverallAssessment.EquipmenFacilities.length; i++) {
                            var user = $OverallAssessment.EquipmenFacilities[i];
                            if (OverallAssessmentTypeName && user.OverallAssessmentTypeName.indexOf(OverallAssessmentTypeName) == -1)
                                continue;
                            if (ContractorName && user.ContractorName.indexOf(ContractorName) == -1)
                                continue;

                            user.OverallAssessmentTypeName = getDicValue("56", user.OverallAssessmentTypeName) == '' ? user.OverallAssessmentTypeName : getDicValue("56", user.DailyAssessmentTypeName);
                            user.TerritorialAppraiser = getDicValue("61", user.TerritorialAppraiser) == '' ? user.TerritorialAppraiser : getDicValue("61", user.TerritorialAppraiser);
                            limitUsers2.push(user);
                        }

                        var limitUsers = [];
                        for (var i = 0; i < limitUsers2.length; i++) {
                            if (i < offset + limit && i >= offset) {
                                limitUsers.push(limitUsers2[i]);
                            }
                        }
                        return {
                            result: "Success",
                            message: null,
                            data: {
                                pageData: limitUsers,
                                rowCount: limitUsers2.length
                            }
                        };
                    });
                break;
                ////获取Input数据
            case '/api/OverallAssessment/get':
                Mock.mock(host + url + '?' + param, type, function (options) {

                    var myUsers = parent.$OverallAssessment.EquipmenFacilities;
                    myuser = {};
                    for (var i = 0; i < myUsers.length; i++) {
                        if (myUsers[i].id == vueApp.id) {
                            myuser = myUsers[i];
                            break;
                        }
                    }
                    //    myuser.IsContractorDirectory = getDicKey("50", myuser.IsContractorDirectory);
                    return {
                        result: "Success",
                        message: null,
                        data: myuser
                    };
                });
                break;
                ////提交
            case '/api/OverallAssessment/Save':
                Mock.mock(host + url, type, function (options) {
                    var thisuser = JSON.parse(options.body);
                    var thisUsers = parent.$OverallAssessment.EquipmenFacilities;
                    var cz = true;
                    for (var i = 0; i < thisUsers.length; i++) {
                        if (thisUsers[i].id == thisuser.id) {
                            thisUsers[i].OverallAssessmentTypeName = thisuser.OverallAssessmentTypeName;
                            thisUsers[i].ContractorName = thisuser.ContractorName;
                            thisUsers[i].ProjectName = thisuser.ProjectName;
                            thisUsers[i].ContractNo = thisuser.ContractNo;
                            thisUsers[i].Fraction = thisuser.Fraction;
                            thisUsers[i].TerritorialAppraiser = thisuser.TerritorialAppraiser;
                            thisUsers[i].TerritorialEvaluationConclusion = thisuser.TerritorialEvaluationConclusion;
                            thisUsers[i].TerritorialEvaluationDate = thisuser.TerritorialEvaluationDate;
                            thisUsers[i].BusinessManagementEvaluator = thisuser.BusinessManagementEvaluator;
                            thisUsers[i].BusinessManagementEvaluationConclusion = thisuser.BusinessManagementEvaluationConclusion;
                            thisUsers[i].BusinessManagementEvaluationData = thisuser.BusinessManagementEvaluationData;
                            thisUsers[i].IsContractorDirectory = thisuser.IsContractorDirectory;
                            thisUsers[i].SummaryEvaluator = thisuser.SummaryEvaluator;
                            thisUsers[i].SummaryEvaluationDate = thisuser.SummaryEvaluationDate;
                            thisUsers[i].CheckProjectList = thisuser.CheckProjectList;
                            cz = false;
                            break;
                        }
                    }
                    if (cz) {
                        //Input 页面需要 去操作List页面的数组 parent
                        parent.$OverallAssessment.EquipmenFacilities.push({

                            id: thisuser.id,
                            OverallAssessmentTypeName: thisuser.OverallAssessmentTypeName,
                            ContractorName: thisuser.ContractorName,
                            ProjectName: thisuser.ProjectName,
                            Fraction: thisuser.Fraction,
                            ContractNo: thisuser.ContractNo,
                            TerritorialAppraiser: thisuser.TerritorialAppraiser,
                            TerritorialEvaluationConclusion: thisuser.TerritorialEvaluationConclusion,
                            TerritorialEvaluationDate: thisuser.TerritorialEvaluationDate,
                            BusinessManagementEvaluator: thisuser.BusinessManagementEvaluator,
                            BusinessManagementEvaluationConclusion: thisuser.BusinessManagementEvaluationConclusion,
                            BusinessManagementEvaluationData: thisuser.BusinessManagementEvaluationData,
                            IsContractorDirectory: thisuser.IsContractorDirectory,
                            SummaryEvaluator: thisuser.SummaryEvaluator,
                            SummaryEvaluationDate: thisuser.SummaryEvaluationDate,
                            CheckProjectList: thisuser.CheckProjectList,
                        });
                    }
                    return {
                        result: "Success",
                        message: null,
                        data: null
                    };
                });
                break;

            case '/api/OverallAssessment/GetPeopelList':
                Mock.mock(host + url, type,
                    function (options) {
                        if ($OverallAssessment.PelpleList.length == 0) {
                            $OverallAssessment.GetPelpleList();
                        }

                        var p = JSON.parse(options.body);
                        //条件
                        var PelpelName = p.model.PelpelName;

                        //分页
                        var offset = p.offset;
                        var limit = p.limit;
                        var limitUsers2 = [];
                        for (var i = 0; i < $OverallAssessment.PelpleList.length; i++) {
                            var user = $OverallAssessment.PelpleList[i];
                            if (PelpelName && user.PelpelName.indexOf(PelpelName) == -1)
                                continue;
                            limitUsers2.push(user);
                        }

                        var limitUsers = [];
                        for (var i = 0; i < limitUsers2.length; i++) {
                            if (i < offset + limit && i >= offset) {
                                limitUsers.push(limitUsers2[i]);
                            }
                        }
                        return {
                            result: "Success",
                            message: null,
                            data: {
                                pageData: limitUsers,
                                rowCount: limitUsers2.length
                            }
                        };
                    });
                break;
        }
    },
    EquipmenFacilities: [],
    InitArray: function () {
        for (var i = 0; i < 80; i++) {
            $OverallAssessment.EquipmenFacilities.push(Mock.mock({
                id: Mock.Random.id(),
                OverallAssessmentTypeName: randomValue("56"), //日常评估考核类别名称
                ContractorName: randomValue("139"), //"承包商名称"
                ProjectName: Mock.mock('@cparagraph(1, 1)'), //"项目名称"
                ContractNo: Mock.mock('@cparagraph(1, 1)'), //"合同号"
                Fraction: random(80, 100), // 分数
                TerritorialAppraiser: randomValue("61"), //属地评价人
                TerritorialEvaluationConclusion: Mock.mock('@cparagraph(1, 1)'), //属地评价结论
                TerritorialEvaluationDate: Mock.mock('@date()'), //属地评价日期
                BusinessManagementEvaluator: Mock.Random.cname(), //业务管理评价人
                BusinessManagementEvaluationConclusion: Mock.mock('@cparagraph(1, 1)'), //业务管理评价结论
                BusinessManagementEvaluationData: Mock.mock('@date()'), //业务管理评价日期
                IsContractorDirectory: randomValue("50"), //是否列入合格承包商名录
                SummaryEvaluator: Mock.Random.cname(), //总结评价人
                SummaryEvaluationDate: Mock.mock('@date()'), //总结评价日期
                CheckProjectList: OverallAssessmentCheckedProject(),
            }));
        }
    },
    PelpleList: [],
    GetPelpleList: function () {
        for (var i = 0; i < 15; i++) {
            $OverallAssessment.PelpleList.push(Mock.mock({
                id: Mock.Random.id(),
                PelpelName: getDicValue("61", i),
                Depart: Mock.Random.cname(),

            }));
        }
    }
}

function OverallAssessmentCheckedProject() {
    var CheckProjectList = [];
    for (var i = 0; i < 5; i++) {
        var Number = random(0, 4);
        var score = random(10, 30);
        var CheckProject = {};
        CheckProject.CheckProject = getDicValue("107", Number);
        CheckProject.TheWeight = score;
        CheckProject.score = score;
        CheckProject.reviewPeople = getDicValue("61", Number),
            CheckProject.instructions = Mock.mock('@cparagraph(1, 1)'), //情况说明
            CheckProjectList.push(CheckProject);
    }
    return CheckProjectList;
}
//总体评估考核评分
var $OverallAssessmentScore = {
    DealUrl: function (vueApp, url, type, param) {
        var my = vueApp;
        switch (url) {
            ////删除
            case '/api/Overall/DeleteMuti':
                Mock.mock(host + url, type, function (options) {
                    var delIDs = options.body;
                    var temp = [];
                    for (var i = 0; i < $OverallAssessmentScore.EquipmenFacilities.length; i++) {
                        temp.push($OverallAssessmentScore.EquipmenFacilities[i]);
                    }
                    for (var i = 0; i < temp.length; i++) {
                        if (delIDs.includes(temp[i].id)) {
                            $OverallAssessmentScore.EquipmenFacilities.splice(temp[i], 1);
                        }
                    }
                    return {
                        result: "Success",
                        message: null,
                        data: null
                    };
                });
                break;
                //获取List数据
            case '/api/Overall/GetList':
                Mock.mock(host + url, type,
                    function (options) {
                        if ($OverallAssessmentScore.EquipmenFacilities.length == 0) {
                            $OverallAssessmentScore.InitArray();
                        }
                        var p = JSON.parse(options.body);
                        //条件
                        var ContractorName = p.model.ContractorName;
                        var Type = getDicValue("56", p.model.Type);
                        //分页
                        var offset = p.offset;
                        var limit = p.limit;
                        var limitUsers2 = [];
                        for (var i = 0; i < $OverallAssessmentScore.EquipmenFacilities.length; i++) {
                            var user = $OverallAssessmentScore.EquipmenFacilities[i];
                            if (Type && user.Type.indexOf(Type) == -1)
                                continue;
                            if (ContractorName && user.ContractorName.indexOf(ContractorName) == -1)
                                continue;

                            user.Type = getDicValue("29", user.Type) == '' ? user.Type : getDicValue("29", user.Type);
                            limitUsers2.push(user);
                        }

                        var limitUsers = [];
                        for (var i = 0; i < limitUsers2.length; i++) {
                            if (i < offset + limit && i >= offset) {
                                limitUsers.push(limitUsers2[i]);
                            }
                        }
                        return {
                            result: "Success",
                            message: null,
                            data: {
                                pageData: limitUsers,
                                rowCount: limitUsers2.length
                            }
                        };
                    });
                break;
                //获取Input数据
            case '/api/Overall/get':
                Mock.mock(host + url + '?' + param, type, function (options) {
                    var myUsers = parent.$OverallAssessmentScore.EquipmenFacilities;
                    myuser = {};
                    for (var i = 0; i < myUsers.length; i++) {
                        if (myUsers[i].id == vueApp.id) {
                            myuser = myUsers[i];
                            break;
                        }
                    }
                    return {
                        result: "Success",
                        message: null,
                        data: myuser
                    };
                });
                break;
                //提交
            case '/api/Overall/Save':
                Mock.mock(host + url, type, function (options) {
                    var thisuser = JSON.parse(options.body);
                    var thisUsers = parent.$OverallAssessmentScore.EquipmenFacilities;
                    var cz = true;
                    var myDate = new Date();
                    var datetime = myDate.toLocaleString();
                    for (var i = 0; i < thisUsers.length; i++) {
                        if (thisUsers[i].id == thisuser.id) {
                            thisUsers[i].OverallAssessmentTypeName = thisuser.OverallAssessmentTypeName;
                            thisUsers[i].ContractorName = thisuser.ContractorName;
                            thisUsers[i].ProjectName = thisuser.ProjectName;
                            thisUsers[i].ContractNo = thisuser.ContractNo;
                            thisUsers[i].CommentItem = thisuser.CommentItem;
                            thisUsers[i].TheWeight = thisuser.TheWeight;
                            thisUsers[i].Score = thisuser.Score;
                            thisUsers[i].EvaluationDescription = thisuser.EvaluationDescription;
                            thisUsers[i].EvaluationTime = datetime;
                            cz = false;
                            break;
                        }
                    }
                    if (cz) {
                        //Input 页面需要 去操作List页面的数组 parent
                        parent.$OverallAssessmentScore.EquipmenFacilities.push({
                            id: thisuser.id,
                            OverallAssessmentTypeName: thisuser.OverallAssessmentTypeName,
                            ContractorName: thisuser.ContractorName,
                            ProjectName: thisuser.ProjectName,
                            ContractNo: thisuser.ContractNo,
                            CommentItem: thisuser.CommentItem,
                            TheWeight: thisuser.TheWeight,
                            Score: thisuser.Score,
                            EvaluationDescription: thisuser.EvaluationDescription,
                            EvaluationTime: thisuser.EvaluationTime,
                        });
                    }
                    return {
                        result: "Success",
                        message: null,
                        data: null
                    };
                });
                break;
        }
    },
    EquipmenFacilities: [],
    InitArray: function () {
        for (var i = 0; i < 80; i++) {
            var score = random(10, 60);
            $OverallAssessmentScore.EquipmenFacilities.push(Mock.mock({
                id: Mock.Random.id(),
                OverallAssessmentTypeName: randomValue("56"), //日常评估考核类别名称
                ContractorName: randomValue("139"), //"承包商名称"
                // ProjectName: Mock.mock('@cparagraph(1, 1)'), //"项目名称"
                ProjectName: randomValue("chy1"), //"项目名称"
                ContractNo: Mock.mock('@cparagraph(1, 1)'), //"合同号"
                CommentItem: randomValue("107"), // 分数
                Qualified1: randomValue("57"), // 
                Qualified2: randomValue("57"), // 
                YesOrNo: randomValue("50"), // 
                TheWeight: score, //权重
                Score: score, //得分
                Data: Mock.mock('@date()'), //日期
                ContractNo: randomValue("n102"), // 合格
                EvaluationDescription: Mock.mock('@cparagraph(1, 1)'), //业务管理评价结论
                EvaluationTime: Mock.mock('@date()'), //业务管理评价日期
                Type: randomValue("29"), //类型
                AllFraction: 70, //类型
                EvaluationResult: Mock.mock('@cparagraph(1, 1)'),
            }));
        }
    }
}
//<!--承包商人员入场名单-->
var $ContractorAdmission = {
    DealUrl: function (vueApp, url, type, param) {
        var my = vueApp;
        switch (url) {
            ////删除
            case '/api/ContractorAdmission/DeleteMuti':
                Mock.mock(host + url, type, function (options) {
                    var delIDs = options.body;
                    var temp = [];
                    for (var i = 0; i < $ContractorAdmission.EquipmenFacilities.length; i++) {
                        temp.push($ContractorAdmission.EquipmenFacilities[i]);
                    }
                    for (var i = 0; i < temp.length; i++) {
                        if (delIDs.includes(temp[i].id)) {
                            $ContractorAdmission.EquipmenFacilities.splice(temp[i], 1);
                        }
                    }
                    return {
                        result: "Success",
                        message: null,
                        data: null
                    };
                });
                break;
            case '/api/ContractorAdmission/Lichang':
                Mock.mock(host + url, type, function (options) {
                    var delIDs = options.body;
                    var temp = [];
                    for (var i = 0; i < $ContractorAdmission.EquipmenFacilities.length; i++) {
                        temp.push($ContractorAdmission.EquipmenFacilities[i]);
                    }
                    for (var i = 0; i < temp.length; i++) {
                        if (delIDs.includes(temp[i].id)) {
                            temp[i].FactoryConfirmer = Mock.Random.cname(); //姓名
                            temp[i].FactoryTime = Mock.mock('@dateTime()');
                        }
                    }
                    return {
                        result: "Success",
                        message: null,
                        data: null
                    };
                });
                break;
                //获取List数据
            case '/api/ContractorAdmission/GetList':
                Mock.mock(host + url, type,
                    function (options) {
                        if ($ContractorAdmission.EquipmenFacilities.length == 0) {
                            $ContractorAdmission.InitArray();
                        }
                        var p = JSON.parse(options.body);
                        //条件
                        var PersonnelName = p.model.PersonnelName;
                        var ContractorName = p.model.ContractorName;
                        var ConstructionCategory = getDicValue("25", p.model.ConstructionCategory);
                        //分页
                        var offset = p.offset;
                        var limit = p.limit;
                        var limitUsers2 = [];
                        for (var i = 0; i < $ContractorAdmission.EquipmenFacilities.length; i++) {
                            var user = $ContractorAdmission.EquipmenFacilities[i];
                            if (PersonnelName && user.PersonnelName.indexOf(PersonnelName) == -1)
                                continue;
                            if (ContractorName && user.ContractorName.indexOf(ContractorName) == -1)
                                continue;
                            if (ConstructionCategory && user.ConstructionCategory.indexOf(ConstructionCategory) == -1)
                                continue;
                            user.ConstructionCategory = getDicValue("25", user.ConstructionCategory) == '' ? user.ConstructionCategory : getDicValue("25", user.ConstructionCategory);
                            user.sex = getDicValue("01", user.sex) == '' ? user.sex : getDicValue("01", user.sex);
                            limitUsers2.push(user);
                        }

                        var limitUsers = [];
                        for (var i = 0; i < limitUsers2.length; i++) {
                            if (i < offset + limit && i >= offset) {
                                limitUsers.push(limitUsers2[i]);
                            }
                        }
                        return {
                            result: "Success",
                            message: null,
                            data: {
                                pageData: limitUsers,
                                rowCount: limitUsers2.length
                            }
                        };
                    });
                break;
                ////获取Input数据
            case '/api/ContractorAdmission/get':
                Mock.mock(host + url + '?' + param, type, function (options) {

                    var myUsers = parent.$ContractorAdmission.EquipmenFacilities;
                    myuser = {};
                    for (var i = 0; i < myUsers.length; i++) {
                        if (myUsers[i].id == vueApp.id) {
                            myuser = myUsers[i];
                            break;
                        }
                    }
                    myuser.ConstructionCategory = getDicKey("25", myuser.ConstructionCategory);
                    return {
                        result: "Success",
                        message: null,
                        data: myuser
                    };
                });
                break;
                ////提交
            case '/api/ContractorAdmission/Save':
                Mock.mock(host + url, type, function (options) {
                    var thisuser = JSON.parse(options.body);
                    var thisUsers = parent.$ContractorAdmission.EquipmenFacilities;
                    var cz = true;

                    for (var i = 0; i < thisUsers.length; i++) {
                        if (thisUsers[i].id == thisuser.id) {
                            thisUsers[i].AdmissionName = thisuser.AdmissionName;
                            thisUsers[i].Region = thisuser.Region;
                            thisUsers[i].AdmissionTime = thisuser.AdmissionTime;
                            thisUsers[i].ContractorName = thisuser.ContractorName;
                            thisUsers[i].PeopleList = thisuser.PeopleList;

                            thisUsers[i].FactoryTime = thisuser.FactoryTime;
                            thisUsers[i].AdmissionConfirmer = thisuser.AdmissionConfirmer;
                            thisUsers[i].FactoryConfirmer = thisuser.FactoryConfirmer;
                            cz = false;
                            break;
                        }
                    }
                    if (cz) {
                        for (var i = 0; i < thisuser.PeopleList.length; i++) {
                            parent.$ContractorAdmission.EquipmenFacilities.push({
                                id: Mock.Random.id(),
                                AdmissionName: thisuser.PeopleList[i].PeopleName,
                                Region: thisuser.Region,
                                AdmissionTime: Mock.mock('@dateTime()'),
                                ContractorName: thisuser.ContractorName,
                                PeopleList: thisuser.PeopleList,
                                FactoryTime: thisuser.FactoryTime,
                                AdmissionConfirmer: Mock.Random.cname(),

                            });

                        }
                        //Input 页面需要 去操作List页面的数组 parent

                    }
                    return {
                        result: "Success",
                        message: null,
                        data: null
                    };
                });
                break;
        }
    },
    EquipmenFacilities: [],
    InitArray: function () {
        for (var i = 0; i < 80; i++) {
            var PersonInChargePidA = randomTreeNode(PersonInChargeTree, '0', true);
            var PersonInChargeIdA = randomTreeNode(PersonInChargeTree, PersonInChargePidA);
            $ContractorAdmission.EquipmenFacilities.push(Mock.mock({
                id: Mock.Random.id(),
                AdmissionName: [PersonInChargeIdA], //姓名
                Region: randomValue("n69"), //区域
                AdmissionTime: Mock.mock('@dateTime()'), //
                ContractorName: randomValue("139"), //承包商名称
                FactoryTime: Mock.mock('@dateTime()'), //
                AdmissionConfirmer: Mock.Random.cname(), //姓名
                FactoryConfirmer: Mock.Random.cname(), //姓名
                // PeopleList: [{
                //     PeopleName: ''
                // }],
                PeopleList: PeopleList(),
            }));
        }
    }
}

function PeopleList() {
    var PeopleList = [];

    for (var i = 0; i < 5; i++) {
        var Number = random(0, 4);
        var PeopleListName = {};
        PeopleListName.Name = Mock.Random.cname(), //姓名
            PeopleListName.CertificateValidity = Mock.mock('@date()'), //
            PeopleList.push(PeopleListName);

    }
    return PeopleList;
}




function randomTreeNode(tree, pid, b) {
    var result = '';
    var tempArray = [];
    if (!b) {
        var idArray = [];
        var pidArray = [];
        tree.forEach(function (v, i) {
            if (pid) {
                if (pid == v.pid) {
                    idArray.push(v.id);
                    pidArray.push(v.pid);
                }
            } else {
                idArray.push(v.id);
                pidArray.push(v.pid);
            }
        })
        tempArray = idArray.filter(function (v) {
            return pidArray.indexOf(v) === -1
        });
        result = tempArray[Math.floor(Math.random() * tempArray.length)] + '';
    } else {
        tree.forEach(function (v, i) {
            if (v.pid + '' == '0') {
                tempArray.push(v.id);
            }
        })
        result = tempArray[Math.floor(Math.random() * tempArray.length)] + '';
    }
    return result;
}
//根据tree数据中的id获取对应的name值
function getTreeValue(tree, id) {
    var value = '';
    tree.forEach(function (v, i) {
        if (v.id + '' == id + '') {
            value = v.name;
            return;
        }
    })
    return value;
}
//树型数据扁平化处理
function fnCommon(data, pid) {
    var result = [],
        temp;
    data.forEach(function (v, i) {
        if (v.pid == pid) {
            var obj = {};
            for (var key in v) {
                obj[key] = v[key];
            }
            temp = this.fnCommon(data, data[i].id);
            if (temp.length > 0) {
                obj.children = temp;
            }
            result.push(obj);
        }
    })
    return result
}
//负责人
var PersonInChargeTree = [{
        "id": 100,
        "pid": 0,
        "name": "总经理"
    },
    {
        "id": 200,
        "pid": 0,
        "name": "生产部"
    },
    {
        "id": 300,
        "pid": 0,
        "name": "技术科"
    },
    {
        "id": 400,
        "pid": 0,
        "name": "工程设备科"
    },
    {
        "id": 100001,
        "pid": 100,
        "name": "郑明"
    },
    {
        "id": 100002,
        "pid": 100,
        "name": "郭艳"
    },
    {
        "id": 200001,
        "pid": 200,
        "name": "胡伟"
    },
    {
        "id": 200002,
        "pid": 200,
        "name": "胡博"
    },
    {
        "id": 300001,
        "pid": 300,
        "name": "谢涛"
    },
    {
        "id": 300002,
        "pid": 300,
        "name": "冯军"
    },
    {
        "id": 400001,
        "pid": 400,
        "name": "曹秀英"
    },
]